I have tried with the below code.But it will fail if we have multiple words in the character field.
The values for i could be like "abcde 12345" or "12345 abcde" or abcde efgh 12345" or "12345 abcd efgh".Please let me know how to extract interger and character(alphabets) separately from the character variable.
Code:
def var i as char format "x(30)" no-undo.
def var v as char format "x(30)" no-undo.
def var b as int no-undo.
def var c as int no-undo.
def var v-cleanstring as char no-undo.
set i.
v= substring(i,index(i," ",1),length(i)) no-error.
message "1" v.
b = int(v) no-error.
if error-status:error then do:
v = substring(i,1,index(i," ",1)) no-error.
c= int(v) no-error.
if error-status:error then
leave.
else
v-cleanstring = replace(i,v,"") no-error.
message "3" v-cleanstring.
end.
else do:
v-cleanstring = replace(i,v,"") no-error.
message "4" v-cleanstring.
end.
message "5" v v-cleanstring.
The values for i could be like "abcde 12345" or "12345 abcde" or abcde efgh 12345" or "12345 abcd efgh".Please let me know how to extract interger and character(alphabets) separately from the character variable.
Last edited by a moderator: