PowerBuilder Function Get Token gf_get_token
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Function Name : gf_get_token // Argument Name : source, Arg Type : String, Pass By : Reference // separator, Arg Type : String, Pass By : Value // Return Type : String /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // String Function GET_TOKEN (ref string Source, string Separator) // // The function Get_Token receive, as arguments, the string from which // the token is to be stripped off, from the left, and the separator // character. If the separator character does not appear in the string, // it returns the entire string. Otherwise, it returns the token, not // including the separator character. In either case, the source string // is truncated on the left, by the length of the token and separator // character, if any. /////////////////////////////////////////////////////////////////////////////////////////////////////////////// Integer p String ret p = Pos(source, separator) // Get the position of the separator If p = 0 Then // if no separator, ret = source // return the whole source string and source = "" // make the original source of zero length Else ret = Mid(source, 1, p - 1) // otherwise, return just the token and source = Right(source, Len(source) - p) // strip it & the separator End If Return Ret |
Good Luck!
Subscribe
Login
0 Comments
Oldest