Please enable JavaScript to view this site.

A-Shell Reference

Reviewed and revised October 2024

xcall XFOLD, string {,mode, control}

XFOLD converts (folds) a string to standard upper/lower case.

Parameters

string (String)  [in]

contains the string to be folded or capitalized.

mode (Num)  [in]

may be set to 0 for "word mode" or 1 for "sentence mode." In word mode, each word is capitalized, whereas in sentence mode, typically only the first word of a sentence is capitalized. If not specified, capitalizes as a name (i.e. word mode); see Comments, below.

control  (String)  [in]

contains a list of delimiters, followed by a list of exceptions. The format is:

/delimiters/exception1/exception2/.../exceptionN/

The "/" character in the above string can be any character, as long as it is used consistently and is not part of any of the delimiter or exception strings. The purpose of the exception list is to override the more simplistic capitalization logic, preventing things such as "John Doe Iii" or "Sigmund Freud, M.d." A typical control string might be:

/ ,;:).!?/II/III/Jr/Sr/Mr/Mrs/Ph.D./M.D./i.e./NASA/IRS//

Comments

If only the first argument is specified, then string will be capitalized as a name using an implied control string of:

"/ ,./II/III/Ph.D./M.D.//"

This will, for example, convert string passed as "john q. PUBLIC ii" to "John Q. Public II".

For sentence mode, the delimiters list must contain first all of the word delimiters, then the period, followed by all of the other sentence delimiters. For example, in the list "\ ,;:.!?\", the period, exclamation and question mark are treated as sentence delimiters, while the space, comma, semicolon, and colon are treated as word delimiters.

Each exception must represent a complete word token, and may not begin with a word or sentence delimiter. However, it may end with one.

See Also

The discussion "XCALL XFOLD question?" on the A-Shell Forum.