Hi everybody
I’ve a string like ‘123ABC’ or ‘1111ZX’ and i want to split it like string1 := ‘123’ string2 := ‘ABC’ or string1 := ‘1111’ string2 := ‘ZX’
Thanks
Hi everybody
I’ve a string like ‘123ABC’ or ‘1111ZX’ and i want to split it like string1 := ‘123’ string2 := ‘ABC’ or string1 := ‘1111’ string2 := ‘ZX’
Thanks
Hi,
Here is the code.
a:=‘1qwe123’;
FOR i:=1 TO STRLEN(a) DO
BEGIN
b:=COPYSTR(a,i,1);
CASE b OF
‘a’…‘z’:
textstring:=textstring+b
ELSE
intstring:=intstring+b;
END;
END;
Where a,b,textstring,intstring are of type text and i is of type integer.
Karthik if i have special char in that string for exacmple " Az123@gmail.com" how to split this
Thanks
jerome Marshal. J
Hi brother,
Here is your code…
a:=‘Az123@gmail.com’;
FOR i:=1 TO STRLEN(a) DO
BEGIN
b:=COPYSTR(a,i,1);
IF EVALUATE(No,b) THEN
BEGIN
intstring:=intstring+FORMAT(No);
END
ELSE
BEGIN
CASE b OF
‘a’…‘z’:
textstring:=textstring+b
ELSE
SpecialString:=SpecialString+b;
END;
END;
END;
MESSAGE(intstring);
MESSAGE(textstring);
MESSAGE(SpecialString);
Or shorter:
a := ‘123ABC’;
FOR i:=1 TO STRLEN(a) DO BEGIN
b:=COPYSTR(a,i,1);
CASE b OF
‘0’…‘9’:
intstring:=intstring+b;
ELSE
textstring:=textstring+b
END;
END;
MESSAGE(intstring);
MESSAGE(textstring);