Reputation: 235
I have string coming in this: 12345
I want to split the string above to result: 1-2-3-4-5
Pls help me.
Upvotes: 0
Views: 1939
Reputation: 1645
If its always 5 digits
picture("12345","x-x-x-x-x")
or for a string of any length
stringvar a := "111225678784";
stringvar b := "x";
numbervar c;
stringvar output;
for c := 2 to len(a) do
(
b := b +"-x"
);
output := picture(a,b);
replace "111225678784" with your field
Upvotes: 1
Reputation: 799
Try something like this:
stringvar s;
stringvar result;
numbervar i;
s:= "123456";
if len(s) < 2
then s
else (
result := s[1];
for i:= 2 to len(s) do
(
result := result + "-" + s[i];
);
result;
)
Upvotes: 1