// Function Name : f_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
// 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
0 comments:
Post a Comment