This is COWS String Library.rtf in view mode; [Download] [Up]
Copyright © 1994 by Sean Luke COWS String Library COWS Version 1.4 May 29, 1994 The COWS String library provides fairly good control over strings, the primary data format in COWS. ASCII Character Conversion The functions to-ascii and from-ascii convert one-character strings to and from their ASCII equivalents. to-ascii takes a character and converts it into an ASCII number. from-ascii does the reverse. Case Conversion There are conversion functions provided that change strings to "ALL CAPS," "all lower case", "Titled Case", and "Mixed case. Got it?" Common Characters In addition to (quote), provided by the Standard Library, this library also provides the characters (return) for newline, and (tab). String-Array Access There are functions that provide access to strings as arrays of characters. token returns some indexed character out of a string, while substring returns a range of characters within a string (the third through fifteenth characters, say). length returns the length of a string. Tokenization The same three functions for string-access also provide tokenization if given an optional delimeters string. token returns some indexed token out of the string. substring returns all the characters between and including two tokens. length returns the number of tokens in a string. Library Functions Any item inside [brackets] is optional. token If no delimeters, token returns character number value in string. If delimeters exists, substring breaks string into tokens separated by the delimeter characters in delimeters, and returns token number value in string. (token string value [delimeters]) substring If no delimeters, substring returns characters start-value through end-value of string. end-value may be the word "end", which means the last character in the string. If delimeters exists, substring breaks string into tokens separated by the delimeter characters in delimeters, and returns the string starting with token number start-value and ending with token number end-value. end-value may be the word "end", which means the last token in the string. (substring string start-value end-value [delimeters]) length If no delimeters, length returns the number of characters in string. If delimeters exists, length breaks string into tokens separated by the delimeter characters in delimeters, and the number of tokens in string. (length string [delimeters]) upper-case Returns an ALL-CAPS version of string. For example, "Hello WORLD. here I come" becomes "HELLO WORLD. HERE I COME." (upper-case string) lower-case Returns a lower-case version of string. For example, "Hello WORLD. here I come" becomes "hello world. here i come." (lower-case string) titled-case Returns a titled-case version of string. For example, "Hello WORLD. here I come" becomes "Hello World. Here I Come." (titled-case string) mixed-case Returns a mixed-case version of string. For example, "Hello WORLD. here I come" becomes "Hello world. Here i come." Bug: Mixed-case currently does not properly convert "I" or any proper name that does not start a sentence. (mixed-case string) return Returns a newline. (return) tab Returns a tab. (tab) to-ascii Returns the character of ASCII-value value. (to-ascii value) from-ascii Returns the ASCII value of the first character in value. (from-ascii value)
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.