Re: Splitting string on blanks in 4gl
Posted in 1995
Jack wrote >This is an obvious candidate for a 'c' function. Does one such exist already? >Anyone want to write one? I'm too busy and my 'c' code stinks, but will do it >if there are no other takers. I can think of two approachs at the moment, >1 - chop up the entire string and then worry about popping off the stack >upon return to 4gl. >2 - split on the first delimiter and return the first and remainder field, >the caller then calls as many times as necessary. >cheers >j. I have a function, called as follows: CALL split_string(str, delimstr, returns, strict) RETURNING stat, strpart1, strpart2.... WHERE: str - String you want to break up delimstr - Delimiter string returns - Integer indicating how many STRING variables you want returned. strict - Boolean TRUE/FALSE. When true, the function returns a stat of -1 if the string to split does not contain EXACTLY returns sub-strings in it. On the return side, stat is always returned along with the number of strings requested. I will did it out if anyone is interested. Mark Denham BBC London, UK Mark.Denham@bbc.co.uk