I have a dataframe as below:
+--------+
| Key|
+--------+
| x10x60|
|x1x19x33|
| x12x6|
| a14x4|
|x1x1x1x6|
|x2a23x30|
+--------|
And I want the output like this:
The Key
column can be divide by each x
element and put into xa
/xb
/xc
/xd
by order, but if there are a
elements then place it into ta
/tb
/tc
/td
by order.
+--------+-----+------+-----+-----+-----+----+----+-----+
| Key| xa| xb| xc| xd| ta| tb| tc| td|
+--------+-----+------+-----+-----+-----+----+----+-----+
| x10x60| x10| x60| | | | | | |
|x1x19x33| x1| x19| x33| | | | | |
| x12x6| x12| x6| | | | | | |
| a14x4| | x4| | | a14| | | |
|x1x1x1x6| x1| x1| x1| x6| | | | |
|x2a23x30| x2| | x30| | | a23| | |
+--------|-----+------+-----+-----+-----+----+----+-----+
I tried substr()
or substring()
cannot have the output, but seems stop at the divide.