pSource is the sequence from which to replace characters.
pRep is the delimiter character or string.
The pSource string is first trimmed of any whitespace, then sets of one
or more whitespace characters are replaced by a single pRep character.
Example:
sequence result result = compress("\t\tif abc = def then xyz() \t", ' ') ? result -- Should display "if abc = def then xyz()"
See Also: compress_chars, lookup, set_whitespace, split, trim, trim_all, trim_all_chars, trim_chars, trim_left, trim_left_chars, trim_right, trim_right_chars
pSource is the sequence from which to replace characters.
pChars is the sequence containing which characters can be replaced.
pRep is the replacement character.
The pSource string is first trimmed of any pChars, then sets of one
or more pChars is replaced by a single pRep character.
Example:
sequence result result = compress_chars("\t\tif abc = def then xyz() \t", " \t", ',') ? result -- Should display "if,abc,=,def,then,xyz()"
See Also: compress, lookup, set_whitespace, split, trim, trim_all, trim_all_chars, trim_chars, trim_left, trim_left_chars, trim_right, trim_right_chars
This searches pSource for pItem and if found, it returns the
corresponding element from pTarget.
If pItem is not found in pSource, then what is returned depends
on a few things.
If pTarget is longer than pSource then the last element in
pTarget is returned. This implements a way to return a default
value of your choosing.
If pTarget is not longer than pSource then if the first element
of pTarget is an atom then zero is returned otherwise an empty
sequence is returned.
Examples:
x = lookup('a', "cat", "dog") --> 'o' x = lookup('d', "cat", "dogx") --> 'x' x = lookup('d', "cat", "dog") --> 0 x = lookup("ape", {"ant","bear","cat"}, {"spider","seal","dog"}) --> "" x = lookup("ant", {"ant","bear","cat"}, {"spider","seal","dog"}) --> "spider"
See Also: compress, compress_chars, set_whitespace, split, trim, trim_all, trim_all_chars, trim_chars, trim_left, trim_left_chars, trim_right, trim_right_chars
pChars is the new set of whitespace characters.
Initially, the set of whitespace characters is
Space, Tab, LineFeed, Carriage Return, Form Feed and Vertical Tab
These correspond to ASCII 32, 9, 10, 13, 12, 11
Note: If pChars is an empty sequence, the current set will not be changed. It will still be returned though.
Example:
sequence oldWS, result oldWS = set_whitespace(",.()[]{}") result = trim_all("123 Smith St., Collingwood, 3728, (VIC).") ? result -- Should display "123 Smith St Collingwood 3728 VIC" oldWS = set_whitespace(oldWS)
See Also: compress, compress_chars, lookup, split, trim, trim_all, trim_all_chars, trim_chars, trim_left, trim_left_chars, trim_right, trim_right_chars
pSource is the sequence from which to extract the substrings.
pDelim is the delimiter character, delimiter string, or a set of
single character delimiters.
Note 1 - if pDelim is an atom and not equal to '{' then sections
of text enclosed in matching '{' and '}' are not scanned.
Note 2 - if pDelim is a single string inside a sequence, then
it is considered to be a set of delimiter characters and any one of
them can delimiter the pSource. The results in this case are that
each delimitered text is followed by the sequence containing the
character that caused the delimitation. A final empty sequence means
that no delimiter was found to end the pSource text.
Example:
sequence result result = split("if abc = def then xyz()", ' ') ? result -- Should be {"if","abc","=","def","then","xyz()"}------------------------------------------------------ Example of embedded delimiter... result = split("event=Click,font={Courier,12}", ',') ? result -- Should be {"event=Click","font={Courier,12}"}
-- Example of delimiter set... result = split("event=Click,font={Courier,12}", {"=,{}"}) ? result -- Should be {"event","=","Click",",","font","=","","{","Courier",",","12","}"}
See Also: compress, compress_chars, lookup, set_whitespace, trim, trim_all, trim_all_chars, trim_chars, trim_left, trim_left_chars, trim_right, trim_right_chars
pSource is the sequence from which to remove whitespace.
Example:
sequence result result = trim(" abc def ") ? result -- Should display "abc def"
See Also: compress, compress_chars, lookup, set_whitespace, split, trim_all, trim_all_chars, trim_chars, trim_left, trim_left_chars, trim_right, trim_right_chars
pSource is the sequence from which to remove whitespace.
Example:
sequence result result = trim_all(" abc def ") ? result -- Should display "abcdef"
See Also: compress, compress_chars, lookup, set_whitespace, split, trim, trim_all_chars, trim_chars, trim_left, trim_left_chars, trim_right, trim_right_chars
pSource is the sequence from which to remove characters.
pChars is the sequence containing which characters can be removed.
Example:
sequence result result = trim_all_chars("321abc9def123", "1234567890") ? result -- Should display "abcdef"
See Also: compress, compress_chars, lookup, set_whitespace, split, trim, trim_all, trim_chars, trim_left, trim_left_chars, trim_right, trim_right_chars
pSource is the sequence from which to remove whitespace.
Example:
sequence result result = trim("123abc9def321", "3459") ? result -- Should display "12abcdef21"
See Also: compress, compress_chars, lookup, set_whitespace, split, trim, trim_all, trim_all_chars, trim_left, trim_left_chars, trim_right, trim_right_chars
pSource is the sequence from which to remove whitespace.
Example:
sequence result result = trim_left(" abc def ") ? result -- Should display "abc def "----------------------------------------------------
See Also: compress, compress_chars, lookup, set_whitespace, split, trim, trim_all, trim_all_chars, trim_chars, trim_left_chars, trim_right, trim_right_chars
pSource is the sequence from which to remove characters.
pChars is the sequence containing which characters can be removed.
Example:
sequence result result = trim_left_chars("321abc9def123", "1234567890") ? result -- Should display "abc9def123"
See Also: compress, compress_chars, lookup, set_whitespace, split, trim, trim_all, trim_all_chars, trim_chars, trim_left, trim_right, trim_right_chars
pSource is the sequence from which to remove whitespace.
Example:
sequence result result = trim_right(" abc def ") ? result -- Should display " abc def"
See Also: compress, compress_chars, lookup, set_whitespace, split, trim, trim_all, trim_all_chars, trim_chars, trim_left, trim_left_chars, trim_right_chars
pSource is the sequence from which to remove characters.
pChars is the sequence containing which characters can be removed.
Example:
sequence result result = trim_left_chars("321abc9def123", "1234567890") ? result -- Should display "321abc9def"
See Also: compress, compress_chars, lookup, set_whitespace, split, trim, trim_all, trim_all_chars, trim_chars, trim_left, trim_left_chars, trim_right