Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All ,
How to split a single string into individual letters ?
Example : A field called PASSWORD has values
PASSWORD
@aklipo
3!5576
i want to split them like
@ and @ k l i p o
a
k
l
i
p
o
and store in table , so that table is read by reading software .
Thanks & Regards
Shekar
I want each letters in separate columns with column name as Letter1 , Letter2 , Letter3 .... and so on
Example
PASSWORD Letter1 Letter2 Letter3 ............... Letter(i)
CAR C A R
for columns
PASS:
load * Inline
[
PASSWORD
@aklipo
3!5576
yhF&kd#1
]
;
max:
load max(len(PASSWORD)) as Max_Size Resident PASS;
let Num = peek('Max_Size') ;
drop Table max;
sub filling(Number)
left join(PASS)
load PASSWORD , if(len(PASSWORD)>=$(Number),mid(PASSWORD,$(Number),1),null()) as Letter$(Number) Resident PASS;
ENDSUB
for i=1 to $(Num)
call filling($(i));
next
Take a bow
Please help me understanding $(Number)
if(len(PASSWORD)>=$(Number)
$(Number) is a variable for creating and filling new fields
the procedure is called in a loop
call filling(1) - will create one new field Letter1
the condition if(len(PASSWORD)>=$(Number) is used for checking if the letter that we want to create is still in the password or we separated all letters.
for example call filling(8): in @aklipo 7 letters, that means we should put "letter8" column null value
I hope my explanation was clear)
Hi,
another solution might be:
table1:
Generic
LOAD *,
'Char'&IterNo(),
Mid(PASSWORD,IterNo(),1)
INLINE [
PASSWORD
@aklipo
3!5576
] While IterNo()<=Len(PASSWORD);
hope this helps
regards
Marco
Hi Marco,
I was trying to achieve the similar - separated characters in listbox looping through the value characters purely in the UI. I was trying with valueloop(). But could not manage to do it. I have seen some tricky and nice solutions from you. Could you please give this a try too?
Thank you all for the solution ...
Hi,
maybe these examples might be helpful?
table1:
LOAD Text(PASSWORD) as PASSWORD
Inline [
PASSWORD
@aklipo
3!5576
Password
P@$$w0rd
MySecret
Test
1234
12345
qwerty
1q2w3e
];
Marco