I believe there is a function in 4GL to return the position of a certain character in a string?
For example: LET firstname ='ALBERT H.'
I need to manipulate firstname to become 'ALBERT, H.' by searching the first occurence of <space>.
Thanks
David T.
I do not know about the existance of such built-in function in 4GL. You may look for a workaround as follows:
main
define idx smallint, scratch char(20)
let scratch = "'ALBERT H."
let idx = at(scratch," "
if idx > 0 then
let scratch[idx]=","
end if
end main
function at(string,pattern)
define string varchar(255), pattern char(1),
i,ret smallint
let ret=0
for i=1 to length(string clipped)
if string[i,i] = pattern then
let ret=i
exit for
end if
end for
return ret
end function
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.