String Primitives | |
Macros | |
atoi | Convert string to a decimal number. |
cftime | Format time and date. |
characterat | Retrieve the character value within a string. |
compress | Compress repeated instances of white-space characters. |
diff_strings | Compare to strings. |
firstof | Leftmost character search. |
format | Formatted printing. |
index | Search string for a leftmost sub-string or character. |
isalnum | Alphanumeric character predicate. |
isalpha | Alpha character predicate. |
isascii | ASCII character predicate. |
isblank | Blank character predicate. |
iscntrl | Control character predicate. |
iscsym | A symbol character predicate. |
isdigit | Numeric character predicate. |
isgold | Alphanumeric character predicate. |
isgraph | Graphic character predicate. |
islower | Lowercase character predicate. |
isprint | A printable character predicate. |
ispunct | Punctuation character predicate. |
isspace | Space character predicate. |
isupper | Uppercase character predicate. |
isword | Word character predicate. |
isxdigit | Hexadecimal character predicate. |
itoa | Convert an integer into a string. |
lastof | Rightmost character search. |
lower | Convert string or character to lowercase. |
ltrim | Chomp characters from the front of a string. |
macro_list | Retrieve list of current macros. |
read | Read characters from the buffer. |
rindex | Search string for a rightmost sub-string or character. |
rtrim | Chomp characters from the end of a string. |
search_string | Searches for a pattern in a string. |
split | Split a string into tokens. |
split_arguments | Argument split. |
sprintf | Formatted printing to a string. |
sscanf | Read formatted data from string. |
strcasecmp | String case insensitive compare. |
strcasestr | Locate first occurrence of a case insensitive. |
strcmp | String compare. |
strfilecmp | Filename comparison. |
strftime | Format time and date. |
string_count | Count occurrences of characters in a string. |
strpbrk | Search a string for any of a set of characters. |
strpop | Pop the leading character(s). |
strrstr | Locate last occurrence of a sub-string. |
strstr | Locate first occurrence of a sub-string. |
strtod | String to double. |
strtof | String to float. |
strtol | Convert a string into its numeric value. |
strverscmp | Version string compare. |
substr | Extract a sub-string. |
tokenize | Tokenize a string into token elements. |
trim | Chomp characters from a string. |
upper | Convert string or character to uppercase. |
ctype | Character classes |
int atoi( string str, [int svalue = TRUE] )
Convert string to a decimal number.
The atoi() primitive converts the initial portion of the string str into its numeric value. This behaviour is equivalent to using strtol as follows.
val = strtol(str, NULL, 10);
Optionally atoi if svalue is specified and zero then the ascii value of the first character in string is returned. This behaviour is equivalent to using characterat as follows.
val = characterat(str, 1);
str | String object. |
svalue | Optional flag, when stated as FALSE only the value of the leading character is returned. |
The atoi function returns integer value of argument string treated as an ascii number or the ascii value of the first character in string if svalue is zero.
A GriefEdit extension.
int characterat( string str, int index )
Retrieve the character value within a string.
The characterat function returns the character value within the string str located at the specified position index starting at offset one.
str | String object to be searched. |
index | Character index, starting from on offset of 1 being the first character. |
Character value as an integer, otherwise -1.
A GriefEdit extension.
string compress( string str, [int trim = FALSE], [string chars = " \\t\\r\\n"], [int replacement = ' '] )
Compress repeated instances of white-space characters.
The compress() primitive takes a string and removes all multiple white space characters, by converting consecutive white-space characters into a single white-space character.
The default is to compress all tabs, spaces and newline characters. If trimchars is specified, then all characters within the trimchar string are compressed.
If trim is specified then compress() acts the same as
trim(compress(str,trimchars),trimchars)
str | String object to be compressed. |
trim | Optional flag, when TRUE invokes trim on the compressed result. |
chars | Optional string defining the set to characters be to compressed and optionally trimmed. |
replacement | Optional replacement character, if given as a non-positive (<= 0) value when the first character with the consecutive set shall be used. |
Returns a copy of string with all spaces, tabs and newlines mapped to single spaces.
The chars and replacement options are a GriefEdit extensions.
By default BRIEF preserved the first character in every group of compressed characters, whereas GriefEdit replaces them with a single space; unless replacement is stated as a non-positive number (e.g. -1).
int diff_strings( [int flags], string s1, string s2 )
Compare to strings.
The diff_strings() primitive determines whether the specified strings are equivalent based on the set of formatting rules specified by the comparison flags flags.
Line comparison flags, which affects the treatment of whitespace and character case.
Constant |
Description |
---|---|
DIFF_IGNORE_WHITESPACE |
Ignore white-space differences. |
DIFF_IGNORE_CASE |
Ignore character case, whereby characters using different case shall be treated as equivalent. |
DIFF_COMPRESS_WHITESPACE |
Repeated whitespace characters are compressed into a single space and compared as such. |
DIFF_SUPPRESS_LEADING |
Leading whitespace is ignored. |
DIFF_SUPPRESS_TRAILING |
Trailing whitespace is ignored. |
DIFF_SUPPRESS_LFCR |
Line-feed and carriage-return characters are ignored. |
flags | Optional integer flags defining the rules to be applied during their comparison which maybe one or more of the predefined flags or’ed together. If omitted or zero diff_strings behaves similar to strcmp. |
s1 | First string to compare. |
s2 | Second string against which to compare the first. |
The diff_strings() primitive returns zero if the two string are equivalent otherwise non-zero.
A GriefEdit extension.
<diff_buffers>, <diff_lines>, strcmp, strcasecmp
int firstof( string str, string chars, [int &result] )
Leftmost character search.
The firstof() primitive returns the offset to the first occurrence of any of the characters contained within chars in the string str.
If supplied, on success result shall be populated with the matching character otherwise is set if zero.
firstof() is similar to index yet allows multiple characters to be matched.
str | String object to be searched. |
chars | Character set to match against. |
result | Optional result, populated with the matching character value. |
The firstof() primitive returns the starting offset or 0 if non of the characters are found.
A GriefEdit extension.
string format( string format, ... )
Formatted printing.
The format() primitive produces formatted output according to the format specification format. The trailing arguments ... are the integer, string or list expressions used to satisfy the % formatting options; refer to (See: message) for details on the supported format specifications.
The format primitive is similar to the sprintf() primitive with the exception the formatted result is returned directly as a string.
This function is one of a set of formatted output primitives each supporting a common feature set, see message for a complete discussion on the supported format specification syntax.
format | String that contains the text to be written. It can optionally contain an embedded <Format Specification> that are replaced by the values specified in subsequent additional arguments and formatted as requested. |
... | Optional format specific arguments, depending on the format string, the primitive may expect a sequence of additional arguments, each containing a value to be used to replace a format specifier in the format string. There should be at least as many of these arguments as the number of values specified in the format specifiers. Additional arguments are ignored by the primitive. |
The format() primitive returns a string containing the formatted results, as defined by the format specification and the values contained within the associated arguments.
See message
int index( string str, int ch|string s )
Search string for a leftmost sub-string or character.
The index() primitive returns the offset to the first occurrence of the character ch or the string s in the string str.
str | String object to be searched. |
ch|s | Object to be matched against. |
The index() primitive returns the starting offsetr or 0 if the character or string was not found.
The character needle form is a GriefEdit extension.
int isalnum( string |int object, [int index] )
Alphanumeric character predicate.
The isalnum() primitive determines whether the specified object object belongs to the alpha or numeric character-classes.
This is [0 through 9], [A through Z] and [a through z] in the program’s current locale; which is equivalent to (isalpha() || isdigit()).
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested.
The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The isalnum() primitive returns non-zero if object is an alphanumeric character; otherwise it returns 0.
The index option is a GriefEdit extension.
if (isalnum(read(1)))
message("Next character is alnum.");
int isalpha( string |int object, [int index] )
Alpha character predicate.
The isalph() primitive determines whether the specified object object belongs to the alpha character-class.
This is [A through Z] and [a through z] in the program’s current locale; which is equivalent to (isupper()
| islower()).
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested.
The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The isalpha() primitive returns non-zero if object is an alphanumeric character; otherwise it returns 0.
if (isalpha(read(1)))
message("Next character is a alpha character.");
The index option is a GriefEdit extension.
int isascii( string |int object, [int index] )
ASCII character predicate.
The isascii() primitive determines whether the specified object object belongs to the ascii character-class.
This is any character value in the range 0 through 0177 (0 through 0x7F), inclusive.
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested.
The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The isascii() primitive returns non-zero if object is an alphanumeric character; otherwise it returns 0.
if (isascii(read(1)))
message("Next character is an ascii character.");
The index option is a GriefEdit extension.
int isblank( string |int object, [int index] )
Blank character predicate.
The isblank() primitive determines whether the specified object object belongs to the blank character-class.
This is a space ( ) or tab (\t) character.
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested.
The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The isblank() primitive returns non-zero if object is an alphanumeric character; otherwise it returns 0.
if (isblank(read(1)))
message("Next character is blank.");
The index option is a GriefEdit extension.
int iscntrl( string |int object, [int index] )
Control character predicate.
The iscntrl() primitive determines whether the specified object object belongs to the control character-class.
The control-class is any character for which the isprint() subroutine returns a value of False (0) and any character that is designated a control character in the current locale. For the C locale, control characters are the ASCII delete character (0177 or 0x7F), or an ordinary control character
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested.
The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The iscntrl() primitive returns non-zero if object is an control character; otherwise it returns 0.
if (iscntrl(read(1)))
message("Next character is a control character.");
The index option is a GriefEdit extension.
int iscsym( string |int object, [int index] )
A symbol character predicate.
The iscsym() primitive determines whether the specified object object belongs to the c-symbol classes, which represent a symbol in the C/C++, GriefEdit macro and similar languages.
This is [0 through 9], [A through Z], [a through z] and underscore (_) in the program’s current locale. which is equivalent to (isalpha() || isdigit() || _).
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested.
The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The iscsym() primitive returns non-zero if object is a symbol character; otherwise it returns 0.
if (iscsym(read(1)))
message("Next character is symbol character.");
The index option is a GriefEdit extension.
int isdigit( string |int object, [int index] )
Numeric character predicate.
The isdigit() primitive determines whether the specified object object belongs to the numeric character-class.
This is [0 through 9] in the program’s current locale.
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested.
The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The isdigit() primitive returns non-zero if object is an numeric character; otherwise it returns 0.
if (isdigit(read(1)))
message("Next character is a numeric character.");
The index option is a GriefEdit extension.
int isgold( string |int object, [int index] )
Alphanumeric character predicate.
The isgold() primitive determines whether the specified object object belongs to either the function, keypad or special character-classes.
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested. The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The isgold() primitive returns non-zero if object is a meta/gold key character; otherwise it returns 0.
A GriefEdit extension.
if (isgold(read(1)))
message("Next character is gold.");
int isgraph( string |int object, [int index] )
Graphic character predicate.
The isgraph() primitive determines whether the specified object object belongs to the graphic character-classes.
The a graphic character is equivalent to
(isprint() && not-space)
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested.
The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The isgraph() primitive returns non-zero if object is an graphic character; otherwise it returns 0.
if (isgraph(read(1)))
message("Next character is a graphic character.");
The index option is a GriefEdit extension.
int islower( string |int object, [int index] )
Lowercase character predicate.
The islower() primitive determines whether the specified object object belongs to the lower-case character-classes.
This is [a through z] in the program’s current locale.
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested.
The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The islower() primitive returns non-zero if object is an lower-case character; otherwise it returns 0.
if (islower(read(1)))
message("Next character is a lower-case character.");
The index option is a GriefEdit extension.
int isprint( string |int object, [int index] )
A printable character predicate.
The isprint() primitive determines whether the specified object object belongs to the printable character-class.
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested.
The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The isprint() primitive returns non-zero if object is an printable character; otherwise it returns 0.
if (isprint(read(1)))
message("Next character is printable.");
The index option is a GriefEdit extension.
int ispunct( string |int object, [int index] )
Punctuation character predicate.
The ispunct() primitive determines whether the specified object object belongs to the punctuation character-class.
Punctuation characters are ones that are printable ((see isprint )) character but neither alphanumeric (See: isalnum) nor a space (See: isspace).
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested.
The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The ispunct() primitive returns non-zero if object is an alphanumeric character; otherwise it returns 0.
if (ispunct(read(1)))
message("Next character is alnum.");
The index option is a GriefEdit extension.
int isspace( string |int object, [int index] )
Space character predicate.
The isspace() primitive determines whether the specified object object belongs to the space character-class.
White-space characters are (space, form feed (\f), new-line (\n), carriage-return (\r), horizontal tab (\t) or vertical tab (\v).
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested.
The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The issspace() primitive returns non-zero if object is an whitespacec character; otherwise it returns 0.
if (isspace(read(1)))
message("Next character is a space character.");
The index option is a GriefEdit extension.
int isupper( string |int object, [int index] )
Uppercase character predicate.
The isupper() primitive determines whether the specified object object belongs to the uppercase character-class.
This is [A through Z] in the program’s current locale.
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested.
The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The isupper() primitive returns non-zero if object is an uppercase character; otherwise it returns 0.
if (isupper(read(1)))
message("Next character is an uppercase character.");
The index option is a GriefEdit extension.
int isword( string |int object, [int index] )
Word character predicate.
The isword() primitive determines whether the specified object object belongs to the word character-class.
This is [A through Z], [a through z], [o through 9] and underscore (_) or dash (-) in the program’s current locale; which is equivalent to (isalpha() || isdigit() || _ || ‘-’).
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested.
The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The isword() primitive returns non-zero if object is an word character; otherwise it returns 0.
if (isword(read(1)))
message("Next character is a word character.");
The index option is a GriefEdit extension.
int isxdigit( string |int object, [int index] )
Hexadecimal character predicate.
The isxdigit() primitive determines whether the specified object object belongs to the hexadecimal character-class.
This is [0 through 9], [A through f] and [a through f] in the program’s current locale.
The specified object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested.
The optional index allows an alternative character within the string to be tested, with the first character represented by offset one.
object | Character or string object. |
[index] | If a string, an optional character index within the string, starting at offset one being the first character. if the index denotes a character out-of-bounds, the function returns 0. |
The isxdigit() primitive returns non-zero if object is a hexadecimal character; otherwise it returns 0.
if (isxdigit(read(1)))
message("Next character is a hexadecimal character.");
The index option is a GriefEdit extension.
string itoa( int value, [int base = 10] )
Convert an integer into a string.
The itoa() primitive converts an integer value to a string using the specified base and returns the result.
If base is 10 and value is negative, the resulting string is preceded with a minus sign (-). With any other base, value is always considered unsigned.
Upon successful completion, itoa() returns the converted value. If no conversion could be performed, itoa() returns an empty string.
A GriefEdit extension.
int lastof( string str, string chars, [int &result] )
Rightmost character search.
The lastof() primitive returns the offset to the last occurrence of any of the characters contained within chars in the string str.
If supplied, on success result shall be populated with the matching character otherwise is set if zero.
lastof() is similar to rindex yet allows multiple characters to be matched.
str | String object to be searched. |
chars | Character set to match against. |
result | Optional result, populated with the matching character value. |
The lastof() primitive returns the starting offset or 0 if non of the characters are found.
A GriefEdit extension.
string|int lower( string str|int character )
Convert string or character to lowercase.
The lower() primitive converts all alphabetic characters within the string object str or just the specified character ch to lowercase.
Returns the specified object with all alphabetic characters converted to lowercase.
If the argument is a string then a copy of the string is returned, otherwise the integer value of the converted character.
Character support is a GriefEdit extension.
string ltrim( string str, [string chars = " \\t\\r\\n"] )
Chomp characters from the front of a string.
The ltrim() primitive removes leading (or left) characters from the specified string.
The default is to remove all tabs, spaces and newline characters. If chars is specified, then all characters within the trimchar string are removed from the beginning of the string.
Returns a copy of string with all leading white space characters removed. (spaces, tabs and newlines by default).
n/a
list macro_list( [string pattern = NULL] )
Retrieve list of current macros.
The macro_list() primitive retrieves a sorted list of all defined macros.
The optional pattern is a regular expression similar to that accepted by the command line shells (See: file_match), providing an inclusion filter.
pattern | Optional string value containing the macro-name pattern to be applied against each name, only returning the matching. A macro-name expression is a shell style regular expression (See: file_match) (e.g. * for wildcard, ? for wild-character, and [..] to select a range of characters). |
The macro_list() primitive returns a list of strings each containing the name of a macro.
n/a
string read( [int number], [int &status] )
Read characters from the buffer.
The read() primitive reads characters up to the specified number of characters length, if omitted characters are read up to the end of the current buffer including the new-line terminator.
The current buffer position remains unchanged.
number | An optional number of characters to be read. |
status | Optional integer variable reference to be populated with the read completion status, representing the position of the cursor at the end of the read operation; |
The read() primitive returns the string read.
n/a
int rindex( string str, int ch|string s )
Search string for a rightmost sub-string or character.
The rindex() primitive returns the offset to the last (in otherwords the right) occurrence of the character ch or the string s in the string str.
str | String object to be searched. |
ch|s | Object to be matched against. |
The rindex() primitives returns the starting offset or 0 if the character or string was not found.
The character needle form is a GriefEdit extension.
string rtrim( string str, string chars = \\t \\r \\n )
Chomp characters from the end of a string.
The rtrim() primitive removes trailing (or right) characters from the specified string.
The default is to remove all tabs, spaces and newline characters. If chars is specified, then all characters within the trimchar string are removed from the end of the string.
Returns a copy of string with all trailing white space characters removed. (spaces, tabs and newlines by default).
A GriefEdit extension; this is a replacement of the original trim() function.
int search_string( string pattern, string text, [int &length], [int re], [int case] )
Searches for a pattern in a string.
The search_string() primitive searches the string text against the expression pattern. The treatment of the matched pattern may either be a regular-expression or constant string dependent on re and with case folding based on case.
The search_string primitive is provided primary for BRIEF compatibility. Since re and case can reference the current global search states, inconsistent and/or unexpected results may result between usage; as such it is advised that the state-less re_search primitive is used by new macros.
pattern | A string containing the pattern to be matched. |
text | A string containing the text to be search for the specified pattern. |
length | Optional integer variable reference. If ths search is successful and specified is populated with the length of the matched text. |
re | Optional integer value. If re is specified and is zero, then pattern is treated as a literal string not as a regular expression; behaviour being the same as index. Otherwise the string shall be treated as a regular expression using the current global syntax, see re_syntax and search_back for additional information. |
case | Optional integer value specifying whether case folding should occur. If case is specified and is zero, then the search is done with case insensitive. If omitted the current global setting is referenced. |
The search_string() primitive returns the starting character in string where the match was found, or zero if the match failed.
Alternatively, if a \\c anchor was encountered within the pattern, it returns the length of the text from the position of the marker to the end of the matched text plus one.
n/a
list split( string expr, string|integer delims, [int numeric = FALSE], [int noquoting = FALSE], [int empties = FALSE], [int limit = 0] )
Split a string into tokens.
The split() primitive splits the string expr into a list of strings and returns the resulting list.
split provides simple field processing, compared to the tokenize primitive which offers greater functionality.
expr | String to be parsed. |
delims | Specifies either a string containing the characters used to split the token, alternative an integer character value of a single character. |
numeric | If specified and is true(1), then all tokens which start with a digit are converted to a number, rather than a string. Alternative when given as two (2) then values are converted using strtol(), allowing support leading base specifications hexidecimal (0x), octal (0) and binary (0b). |
nonquoting | Upon the delim parameter containing a double quote character then it is assumed that any entries inside double quotes should have any embedded characters preserved. When specified the noquote optional allows explicit control enabling and disabling of this feature. |
empties | Upon the delim character being given as a integer value empty split column are not returned witnin the list. When specified the empties optional allows explicit control enabling (non-zero) and disabling (zero) to whether empties are returned. |
limit | Limit the split to limit elements, returning the trailing content in the last element; note any special processing including quotes and numeric wont apply on the trailing. |
List of strings where each string is a token from the string parameter.
The options empties and limit are GriefEdit extensions.
tokenize, sscanf, index, substr
Using | was a delimiter and empties being returned.
'' ==> ''
'a' ==> 'a'
'|b' ==> '', 'b'
'|' ==> '', ''
'a|b' ==> 'a', 'b'
'a|b|' ==> 'a', 'b', ''
'a|b|c' ==> 'a', 'b', 'c'
'a||b' ==> 'a', '', 'b'
the same without empties
'' ==>
'a' ==> 'a'
'|b' ==> 'b'
'|' ==>
'a|b' ==> 'a', 'b'
'a|b|' ==> 'a', 'b'
'a||b' ==> 'a', 'b'
list split_arguments( string arguments )
Argument split.
The split_arguments() primitive splits argument into list of words. As it parses the command line, split_arguments looks for command separators, white space (spaces and tabs). Normally, these special characters cannot be passed to a command as part of an argument. However, special characters in an argument by enclosing the entire argument in double quotes [“]. The [“] themselves will not be passed to the command as part of the argument. Within a double quoted string the [“] character and [\] character can be represented as [\”] and [\\].
argument | String containing the argument buffer. |
The split_argument returns a list of words encountered within the argument buffer.
A GriefEdit extension.
int sprintf( string & buffer, string format, ... )
Formatted printing to a string.
The sprintf() primitive produces formatted output according to the format specification format into the given string buffer. The trailing arguments ... are the integer, string or list expressions used to satisfy the % formatting options; refer to (See: message) for details on the supported format specifications.
The format primitive is similar to the C sprintf() primitive, exporting the formatted result into the destination buffer.
This function is one of a set of formatted output primitives each supporting a common feature set, see message for a complete discussion on the supported format specification syntax.
buffer | String which shall be populated with the result. |
format | String that contains the text to be written. It can optionally contain an embedded <Format Specification> that are replaced by the values specified in subsequent additional arguments and formatted as requested. |
... | Optional format specific arguments, depending on the format string, the primitive may expect a sequence of additional arguments, each containing a value to be used to replace a format specifier in the format string. There should be at least as many of these arguments as the number of values specified in the format specifiers. Additional arguments are ignored by the primitive. |
The sprintf() primitive returns the number of charaters stored within the result string buffer.
See message
int sscanf( string str, string format, ... )
Read formatted data from string.
The sscanf() primitive reads data from the string buffer str. Data input are stored in the locations specified by argument according to the format string format.
The additional arguments should be objects of the type specified by their corresponding format specifier within the format string.
str | Source buffer. |
format | String that contains a format string, see below. |
... | Additional arguments; depending on the format string, the function may expect a sequence of additional arguments, each containing a reference to a variable where the interpretation of the extracted characters is stored with the appropriate type. There should be at least as many of these arguments as the number of values stored by the format specifiers. Additional arguments are ignored by the function. |
The sscanf() primitive returns the number of input fields that were successfully converted. An EOF (-1) is returned if an error is encountered.
A GriefEdit extension.
The format may be composed of one or more whitespace characters, non whitespace characters, and format specifications.
The format string is read from left to right. Characters that are not part of the format specifications must match characters in the input stream. These characters are read from the input stream but are discarded and not stored. If a character in the input stream conflicts with the format string, scanf terminates. Any conflicting characters remain in the input stream.
The first format specification encountered in the format string references the first argument after format. The scanf function converts input characters and stores the value using the format specification. The second format specification accesses the second argument after format, and so on. If there are more arguments than format specifications, the extra arguments are ignored. Results are unpredictable if there are not enough arguments for the format specifications.
Values in the input stream are called input fields and are delimited by whitespace characters. When converting input fields, scanf ends a conversion for an argument when a whitespace character or another unrecognized character is encountered.
% [*] [width] type
Each field in the format specification can be a single character or a number which specifies a particular format option.
The type field is where a single character specifies whether input characters are interpreted as a character, string, or number. This field can be any one of the characters in the following table.
Character |
Argument Type |
Input Format |
---|---|---|
d |
int & |
Signed decimal number. |
i |
int & |
Signed decimal, hexadecimal, or octal integer. |
u |
int & |
Unsigned decimal number. |
o |
int & |
Unsigned octal number. |
x |
int & |
Unsigned hexadecimal number. |
e |
float & |
Floating-point number. |
f |
float & |
Floating-point number. |
g |
float & |
Floating-point number. |
c |
int & |
A single character. |
s |
string & |
A string of characters terminated by whitespace. |
\[ |
string & |
A string not to be delimited by space characters. |
An asterisk (*) as the first character of a format specification causes the input field to be scanned but not stored. The asterisk suppresses assignment of the format specification.
The width field is a non-negative number that specifies the maximum number of characters read from the input stream. No more than width characters are read and converted for the corresponding argument. However, fewer than width characters may be read if a whitespace or other unrecognized character is encountered first.
[ indicates a string not to be delimited by space characters.
The conversion specification includes all subsequent characters in the format string up to and including the matching right square bracket (]).
The characters between the square brackets comprise the scanset, unless the character after the left square bracket is a circumflex (^), in which case the scanset contains all characters that do not appear in the scanlist between the circumflex and the right square bracket.
If the conversion specification begins with “[]” or “[^]”, the right square bracket is included in the scanlist and the next right square bracket is the matching right square bracket that ends the conversion specification; otherwise the first right square bracket is the one that ends the conversion specification.
If a hyphen character (-) is in the scanlist and is not the first character, nor the second where the first character is a circumflex (^), nor the last character, it indicates a range of characters to be matched. To include a hyphen, make it the last character before the final close bracket. For instance, `[^]0-9-]’ means the set `everything except close bracket, zero through nine, and hyphen’.
Character classes
Within a bracket expression, the name of a character class enclosed in [: and :] stands for the list of all characters (not all collating elements!) belonging to that class.
Identifier |
Description |
---|---|
alpha |
A letter. |
upper |
An upper-case letter. |
lower |
A lower-case letter. |
blank |
A space or tab character. |
digit |
A decimal digit. |
xdigit |
A hexadecimal digit. |
alnum |
An alphanumeric (letter or digit). |
print |
An alphanumeric (same as alnum). |
blank |
A space or tab character. |
space |
A character producing white space in displayed text. |
punct |
A punctuation character. |
graph |
A character with a visible representation. |
cntrl |
A control character. |
word |
A “word” character (alphanumeric plus “_”). |
int strcasecmp( string s1, string s2, [int length] )
String case insensitive compare.
The strcmp() primitive shall compare the string s1 to the string s2, ignoring case.
s1 | First string. |
s2 | Second string to compare against. |
length | Optional, when specified only the first length characters of both string shall be compared. |
strcasecmp() shall return an integer greater than, equal to, or less than 0, if the string pointed to by s1 is greater than, equal to, or less than the string pointed to by s2, respectively; when ignoring case.
A GriefEdit extension.
sub-string. int strcasestr( string haystack, string needle )
Locate first occurrence of a case insensitive.
The strcasestr() primitive finds the first occurrence of the case insensitive sub-string needle in the string haystack.
haystack | String object to be searched. |
needle | String to be matched. |
Index of first matching character starting at the index one, otherwise zero if no match.
A GriefEdit extension.
int strcmp( string s1, string s2, [ int length] )
String compare.
The strcmp() primitive shall compare the string s1 to the string s2 not ignoring case.
s1 | First string. |
s2 | Second string to compare against. |
length | Optional, when specified only the first length characters of both string shall be compared. |
strcmp() shall return an integer greater than, equal to, or less than 0, if the string pointed to by s1 is greater than, equal to, or less than the string pointed to by s2, respectively.
A GriefEdit extension.
int strfilecmp( string file1, string file2, [int length] )
Filename comparison.
The strfilecmp() primitive lexicographically compares the filenames name1 and name2 and returns a value indicating their relationship, taking into account any filesystem implementation specifics.
If specified length defines the number of significant characters of each path which shall be compared, ignoring any characters after the length characters of each.
Under DOS, Windows and OS/2 this primitive is case insensitive and permits the intermixing of both back(\) and forward(/) slashes as directory delimiters.
Under Unix™ this primitive is the same as an equality (==) operation between two strings.
The return indicates the lexicographic relation of name1 and name2.
<0 - name1 less than name2.
0 - name1 identical to name2.
>0 - name1 greater than name2.
A GriefEdit extenions.
string strftime( [string format = NULL], [int time = NULL] )
Format time and date.
The strftime() primitive is an interface to the system library function strftime. Unless time is specified, the current time shall be formatted otherwise the stated time shall be formatted.
The format specification is a string and may contain special character sequences called conversion specifications, each of which is introduced by a % character and terminated by some other character known as a conversion specifier character. All other character sequences are ordinary character sequences.
Most implementations support the following conversion specifications.
%a | is replaced by the locale’s abbreviated weekday name. |
%A | is replaced by the locale’s full weekday name. |
%b | is replaced by the locale’s abbreviated month name. |
%B | is replaced by the locale’s full month name. |
%c | is replaced by the locale’s appropriate date and time representation. |
%C | is replaced by the century number (the year divided by 100 and truncated to an integer) as a decimal number [00-99]. |
%d | is replaced by the day of the month as a decimal number [01,31]. |
%D | same as %m/%d/%y. |
%e | is replaced by the day of the month as a decimal number [1,31]; a single digit is preceded by a space. |
%h | same as %b. |
%H | is replaced by the hour (24-hour clock) as a decimal number [00,23]. |
%I | is replaced by the hour (12-hour clock) as a decimal number [01,12]. |
%j | is replaced by the day of the year as a decimal number [001,366]. |
%m | is replaced by the month as a decimal number [01,12]. |
%M | is replaced by the minute as a decimal number [00,59]. |
%n | is replaced by a newline character. |
%p | is replaced by the locale’s equivalent of either a.m. or p.m. |
%r | is replaced by the time in a.m. and p.m. notation; in the POSIX locale this is equivalent to %I:%M:%S %p. |
%R | is replaced by the time in 24 hour notation (%H:%M). |
%S | is replaced by the second as a decimal number [00,61]. |
%t | is replaced by a tab character. |
%T | is replaced by the time (%H:%M:%S). |
%u | is replaced by the weekday as a decimal number [1, 7], with 1 representing Monday. |
%U | is replaced by the week number of the year (Sunday as the first day of the week) as a decimal number [00,53]. |
%V | is replaced by the week number of the year (Monday as the first day of the week) as a decimal number [01, 53]. If the week containing 1 January has four or more days in the new year, then it is considered week 1. Otherwise, it is the last week of the previous year, and the next week is week 1. |
%w | is replaced by the weekday as a decimal number [0, 6], with 0 representing Sunday. |
%W | is replaced by the week number of the year (Monday as the first day of the week) as a decimal number [00, 53]. All days in a new year preceding the first Monday are considered to be in week 0. |
%x | is replaced by the locale’s appropriate date representation. |
%X | is replaced by the locale’s appropriate time representation. |
%y | is replaced by the year without century as a decimal number [00,99]. |
%Y | is replaced by the year with century as a decimal number. |
%Z | is replaced by the timezone name or abbreviation, or by no bytes if no timezone information exists. |
%% | is replaced by %. |
The strftime function returns a string containing the formatted time and date.
A GriefEdit extension.
int string_count( string haystack, int needle|string needles )
Count occurrences of characters in a string.
The string_count() primitive computes the number of occurrences of the character(s) within needles in the string haystack.
haystack | String to be searched. |
needle | Elements to the counted, each character shall be accumulated. |
Returns the number of times the characters in needle occur in the string parameter.
The integer needle form is a GriefEdit extension.
int strpbrk( string str, string characters )
Search a string for any of a set of characters.
The strpbrk() primitive returns the index of the first character in str which matches any character from the string characters.
This function is like index() and rindex() yet these only matches a single character string rather than a complete sub-string.
Index of first matching character starting at the index one, otherwise zero if no match.
A GriefEdit extension.
string strpop( string str, [int length = 1] )
Pop the leading character(s).
The strpop() primitive is equivalent to substr(sym, 1, length) with the additional functionality that the returned character is removed from the specified string str.
length is a GriefEdit extension.
String value containing the first character(s) of the original value of sym.
int strrstr( string haystack, string needle )
Locate last occurrence of a sub-string.
The strrstr() primitive finds the last occurrence of the sub-string needle in the string haystack.
haystack | String object to be searched. |
needle | String to be matched. |
Index of last matching character starting at the index one, otherwise zero if no match.
A GriefEdit extension.
int strstr( string haystack, string needle )
Locate first occurrence of a sub-string.
The strstr() primitive finds the first occurrence of the sub-string needle in the string haystack.
haystack | String object to be searched. |
needle | String to be matched. |
Index of first matching character starting at the index one, otherwise zero if no match.
A GriefEdit extension.
int strtod( string str, [int &endofoffset] )
String to double.
The strtod() primitive converts the initial portion of the string str to a floating point double representation; it is an interface to the standard library function of the same name.
Upon successful completion, strtod() returns the converted value, if any, and (if supplied) an index (base of 1) to the first unprocessed character within the string is stored in the integer object endoffset.
If no conversion could be performed, strtod() returns 0 and errno may be set to EINVAL. The subject sequence contains no characters and index of 0 is stored in endoffset.
If the correct value is outside the range of representable values, strtod() returns HUGE_MAX or HUGE_MIN and errno is set to ERANGE.
A GriefEdit extension.
int strtof( string str, [int &endofoffset] )
String to float.
The strtof() primitive converts the initial portion of the string str to a floating point representation; it is an interface to the standard library function of the same name.
Upon successful completion, strtof() returns the converted value, if any, and (if supplied) an index (base of 1) to the first unprocessed character within the string is stored in the integer object endoffset.
If no conversion could be performed, strtof() returns 0 and errno may be set to EINVAL. The subject sequence contains no characters and index of 0 is stored in endoffset.
If the correct value is outside the range of representable values, strtod() returns FLT_MAX or FLT_MIN and errno is set to ERANGE.
A GriefEdit extension
int strtol( string str, [int &endoffset], [int base] )
Convert a string into its numeric value.
The strtol() primitive converts the initial portion of the string str to a type integer representation; it is an interface to the standard library function of the same name.
If the value of base is 0 (or if not supplied), the expected form of the subject sequence is that of a decimal constant, octal constant or hexadecimal constant, any of which may be preceded by a ‘+ ‘or ‘- ‘sign. A decimal constant begins with a non-zero digit, and consists of a sequence of decimal digits. An octal constant consists of the prefix 0 optionally followed by a sequence of the digits ‘0 ‘to ‘7 ‘only. A hexadecimal constant consists of the prefix 0x or 0X followed by a sequence of the decimal digits and letters a (or A) to f (or F) with values 10 to 15 respectively.
If the value of base is between 2 and 36, the expected form of the subject sequence is a sequence of letters and digits representing an integer with the radix specified by base, optionally preceded by a + or - sign. The letters from a (or A) to z (or Z) inclusive are ascribed the values 10 to 35; only letters whose ascribed values are less than that of base are permitted. If the value of base is 16, the characters 0x or 0X may optionally precede the sequence of letters and digits, following the sign if present.
The subject sequence is defined as the longest initial subsequence of the input string, starting with the first non-white-space character, that is of the expected form. The subject sequence contains no characters if the input string is empty or consists entirely of white-space characters, or if the first non-white-space character is other than a sign or a permissible letter or digit.
If the subject sequence has the expected form and the value of base is 0, the sequence of characters starting with the first digit is interpreted as an integer constant. If the subject sequence has the expected form and the value of base is between 2 and 36, it is used as the base for conversion, ascribing to each letter its value as given above. If the subject sequence begins with a minus sign, the value resulting from the conversion is negated.
Upon successful completion, strtol() returns the converted value, if any, and (if supplied) an index (base of 1) to the first unprocessed character within the string is stored in the integer object endoffset.
If no conversion could be performed, strtol() returns 0 and errno may be set to EINVAL. The subject sequence contains no characters and index of 0 is stored in endoffset.
If the correct value is outside the range of representable values, strtol() returns LONG_MAX or LONG_MIN and errno is set to ERANGE.
A GriefEdit extension.
int strverscmp( string s1, string s2 )
Version string compare.
strverscmp(3)/versionsort(3) style version comparison function.
Often one has files jan1, jan2, ..., jan9, jan10, ... and it feels wrong when ls orders them jan1, jan10, ..., jan2, ..., jan9. In order to rectify this, GNU introduced the -v option to ls(1), which is implemented using versionsort(3), which again uses strverscmp.
Thus, the task of strverscmp is to compare two strings and find the “right” order, while strcmp only finds the lexicographic order.
The strverscmp() primitive returns an integer less than, equal to, or greater than zero if s1 is found, respectively, to be earlier than, equal to, or later than s2.
A GriefEdit extension.
string substr( string str, [int offset], [int length] )
Extract a sub-string.
The substr() primitive extracts parts of a string, beginning at the character at the specified position, and returns the specified number of characters.
The substr() primitive does not change the original string.
offset | The position where to start the extraction. First character is at index 1. |
length | Optional, the number of characters to extract. |
Returns the sub-string of string which starts at start, and goes on for length characters, or the end of the string if length is omitted.
list tokenize( string expr, string delims, int flags, [string whitespace = "\t\n\r"] )
Tokenize a string into token elements.
The tokenize() primitive tokenizes the string expr into a list of strings and returns the list in list context.
tokenize() provides greater field processing then the simpler split primitive and should be used by new macros.
expr | String to be tokenize. |
delims | is a string consisting of one or more characters which indicate the delimiter characters. |
flags | is an integer containing a set of flags which indicate how the input string is to be tokenized. Flags consist of one or more the tokenize flags detailed below OR’ed together. |
whitespace | Optional set of characters to be treated as whitespace. |
""hello world""
The tokensize() primitive returns a list of the words and/or numeric values as encountered within the string str.
Many of the features are GriefEdit specific; CRiSP ™ has a similar primitive yet as the two were developed independently features differ.
string trim( string str, [string chars = " \\t\\r\\n"] )
Chomp characters from a string.
The trim() primitive removes leading and trailing characters from the specified string.
The default is to remove all tabs, spaces and newline characters. If chars is specified, then all characters within the trimchar string are removed from the beginning and end of the string.
str | String object to be trimmed. |
chars | Optional string defining the set to characters to be removed. |
Returns a copy of string with all leading and trailing white space characters removed. (spaces, tabs and newlines by default).
The chars and removal of trailing characters in addition to leading is a GriefEdit extension (See: rtrim).
string|int upper( string str|int character )
Convert string or character to uppercase.
The upper() primitive converts all alphabetic characters within the string object str or just the specified character ch to uppercase.
Returns the specified object with all alphabetic characters converted to uppercase.
If the argument is a string then a copy of the string is returned, otherwise the integer value of the converted character.
Character support is a GriefEdit extension.
Character classes
The GriefEdit ctype (character class) functionality is used to designated character-coded integer values into one or more character types.
Standard character classes are;
The following GriefEdit interfaces have direct support for character-classes:
Bracket expressions
Within sscanf and search <regexp> expressions, the name of a character class enclosed in [: and :] stands for the list of all characters (not all collating elements!) belonging to that class.
Macros
The set of the isaxxxx(object, [index]) primitive exist allowing tests within macros. Each of these subroutines returns a nonzero value is the specified value is contained within the given class, otherwise zero.
The specified argument object can be an integer (whose ASCII code represents a single character), or a string, in which case the first character of the string is tested. The optional index allows an alternative character within the string to be tested, starting at offset one being the first character.
The isaxxx() primitives should only be used on character data that can be represented by a single byte value (0 through 255). Attempting to use the ctype subroutines on multi-byte locale data may give inconsistent results.
sscanf, <regexp>, isalnum, isalpha, isascii, iscntrl, iscsym, isdigit, isgraph, islower, isprint, ispunct, isspace, isupper, isxdigit
$Id: $
To send feedback on this topic email: grie@gmai l.com fedit
Copyright © Adam Young All Rights Reserved.
Convert string to a decimal number.
int atoi( string str, [int svalue = TRUE] )
Format time and date.
string cftime( string format, int time )
Retrieve the character value within a string.
int characterat( string str, int index )
Compress repeated instances of white-space characters.
string compress( string str, [int trim = FALSE], [string chars = " \\t\\r\\n"], [int replacement = ' '] )
Compare to strings.
int diff_strings( [int flags], string s1, string s2 )
Leftmost character search.
int firstof( string str, string chars, [int &result] )
Formatted printing.
string format( string format, ... )
Search string for a leftmost sub-string or character.
int index( string str, int ch|string s )
Alphanumeric character predicate.
int isalnum( string |int object, [int index] )
Alpha character predicate.
int isalpha( string |int object, [int index] )
ASCII character predicate.
int isascii( string |int object, [int index] )
Blank character predicate.
int isblank( string |int object, [int index] )
Control character predicate.
int iscntrl( string |int object, [int index] )
A symbol character predicate.
int iscsym( string |int object, [int index] )
Numeric character predicate.
int isdigit( string |int object, [int index] )
Alphanumeric character predicate.
int isgold( string |int object, [int index] )
Graphic character predicate.
int isgraph( string |int object, [int index] )
Lowercase character predicate.
int islower( string |int object, [int index] )
A printable character predicate.
int isprint( string |int object, [int index] )
Punctuation character predicate.
int ispunct( string |int object, [int index] )
Space character predicate.
int isspace( string |int object, [int index] )
Uppercase character predicate.
int isupper( string |int object, [int index] )
Word character predicate.
int isword( string |int object, [int index] )
Hexadecimal character predicate.
int isxdigit( string |int object, [int index] )
Convert an integer into a string.
string itoa( int value, [int base = 10] )
Rightmost character search.
int lastof( string str, string chars, [int &result] )
Convert string or character to lowercase.
string|int lower( string str|int character )
Chomp characters from the front of a string.
string ltrim( string str, [string chars = " \\t\\r\\n"] )
Retrieve list of current macros.
list macro_list( [string pattern = NULL] )
Read characters from the buffer.
string read( [int number], [int &status] )
Search string for a rightmost sub-string or character.
int rindex( string str, int ch|string s )
Chomp characters from the end of a string.
string rtrim( string str, string chars = \\t \\r \\n )
Searches for a pattern in a string.
int search_string( string pattern, string text, [int &length], [int re], [int case] )
Split a string into tokens.
list split( string expr, string|integer delims, [int numeric = FALSE], [int noquoting = FALSE], [int empties = FALSE], [int limit = 0] )
Argument split.
list split_arguments( string arguments )
Formatted printing to a string.
int sprintf( string & buffer, string format, ... )
Read formatted data from string.
int sscanf( string str, string format, ... )
String case insensitive compare.
int strcasecmp( string s1, string s2, [int length] )
Locate first occurrence of a case insensitive.
sub-string. int strcasestr( string haystack, string needle )
String compare.
int strcmp( string s1, string s2, [ int length] )
Filename comparison.
int strfilecmp( string file1, string file2, [int length] )
Format time and date.
string strftime( [string format = NULL], [int time = NULL] )
Count occurrences of characters in a string.
int string_count( string haystack, int needle|string needles )
Search a string for any of a set of characters.
int strpbrk( string str, string characters )
Pop the leading character(s).
string strpop( string str, [int length = 1] )
Locate last occurrence of a sub-string.
int strrstr( string haystack, string needle )
Locate first occurrence of a sub-string.
int strstr( string haystack, string needle )
String to double.
int strtod( string str, [int &endofoffset] )
String to float.
int strtof( string str, [int &endofoffset] )
Convert a string into its numeric value.
int strtol( string str, [int &endoffset], [int base] )
Version string compare.
int strverscmp( string s1, string s2 )
Extract a sub-string.
string substr( string str, [int offset], [int length] )
Tokenize a string into token elements.
list tokenize( string expr, string delims, int flags, [string whitespace = "\t\n\r"] )
Chomp characters from a string.
string trim( string str, [string chars = " \\t\\r\\n"] )
Convert string or character to uppercase.
string|int upper( string str|int character )
Display a message on the command line.
int message( string format, ... )
File match utility.
int file_match( pattern, file, [flags] )
Retrieve list of built-in and active macros.
list command_list( [int nomacros = FALSE], [string pattern] )
Insert string into current buffer.
int insert( string|int val, [int num = 1] )
Insert a formatted string.
int insertf( string format, ... )
Search for a string.
int re_search( [int flags], [string pattern], [declare object], [int start], [int lensym] )
Set the regular expression mode.
int re_syntax( [int re], [int case], [int capture] )
Backwards buffer search.
int search_back( string pattern, [int re], [int case], [int block], [int length] )
Parse suboption arguments from a string.
int getsubopt( string value, [list options], [string|list args], [string delim], [string quotes] )
Issue an error message on the command line.
int error( string format, ... )
Equality operator.
expr1 == expr2
Comparison operator.
expr1 <=> expr2
Get the current system time.
int time( [int &hour], [int &min], [int &sec], [int &msec] )
Get current system date.
int date( [int &year], [int &month], [int &day], [string &monname], [string &dayname] )
Obtain file information.
int stat( [string path], [int size], [int mtime], [int ctime], [int atime], [int mode], [int uid], [string uid2name], [int gid], [string gid2name], [int nlink], [int inode] )
Convert a time value to local time components.
int localtime( [int time = NULL], [int &year], [int &mon], [int &mday], [string &monname], [string &dayname], [int &hour], [int &min], [int &sec] )
Convert a time value to UTC time components.
int gmtime( [int time = NULL], [int &year], [int &mon], [int &mday], [string &monname], [string &dayname], [int &hour], [int &min], [int &sec] )
Last system errno number.
extern int errno;