determined only by how it is used. *Note Character Type::.
The length of a string (like any array) is fixed and independent of
determined only by how it is used. *Note Character Type::.
The length of a string (like any array) is fixed and independent of
terminated by a distinguished character code. (By contrast, strings in
C are terminated by a character with ASCII code 0.) This means that
any character, including the null character (ASCII code 0), is a valid
terminated by a distinguished character code. (By contrast, strings in
C are terminated by a character with ASCII code 0.) This means that
any character, including the null character (ASCII code 0), is a valid
Since strings are considered arrays, you can operate on them with the
general array functions. (*Note Sequences Arrays Vectors::.) For
example, you can access or change individual characters in a string
Since strings are considered arrays, you can operate on them with the
general array functions. (*Note Sequences Arrays Vectors::.) For
example, you can access or change individual characters in a string
Strings use an efficient representation for storing the characters
in them, and thus take up much less memory than a vector of the same
length.
Sometimes you will see strings used to hold key sequences. This
Strings use an efficient representation for storing the characters
in them, and thus take up much less memory than a vector of the same
length.
Sometimes you will see strings used to hold key sequences. This
used in new code, since many key chords can't be represented at all and
others (in particular meta key chords) are confused with accented
characters.
Strings are useful for holding regular expressions. You can also
used in new code, since many key chords can't be represented at all and
others (in particular meta key chords) are confused with accented
characters.
Strings are useful for holding regular expressions. You can also
-match regular expressions against strings (*note Regexp Search::.). The
-functions `match-string' (*note Simple Match Data::.) and
-`replace-match' (*note Replacing Match::.) are useful for decomposing
+match regular expressions against strings (*note Regexp Search::). The
+functions `match-string' (*note Simple Match Data::) and
+`replace-match' (*note Replacing Match::) are useful for decomposing
and modifying strings based on regular expression matching.
Like a buffer, a string can contain extents in it. These extents are
and modifying strings based on regular expression matching.
Like a buffer, a string can contain extents in it. These extents are
For more information about general sequence and array predicates,
see *Note Sequences Arrays Vectors::, and *Note Arrays::.
For more information about general sequence and array predicates,
see *Note Sequences Arrays Vectors::, and *Note Arrays::.
The following functions create strings, either from scratch, or by
putting strings together, or by taking them apart.
The following functions create strings, either from scratch, or by
putting strings together, or by taking them apart.
- `cons' (*note Building Lists::.), `vector' (*note Vectors::.) and
- `bit-vector' (*note Bit Vectors::.). This function has not been
+ `cons' (*note Building Lists::), `vector' (*note Vectors::) and
+ `bit-vector' (*note Bit Vectors::). This function has not been
- - Function: make-string COUNT CHARACTER
- This function returns a string made up of COUNT repetitions of
- CHARACTER. If COUNT is negative, an error is signaled.
+ - Function: make-string length character
+ This function returns a new string consisting entirely of LENGTH
+ successive copies of CHARACTER. LENGTH must be a non-negative
+ integer.
- (*note String Conversion::.), `make-vector' (*note Vectors::.), and
- `make-list' (*note Building Lists::.).
+ (*note String Conversion::), `make-vector' (*note Vectors::), and
+ `make-list' (*note Building Lists::).
This function returns a new string which consists of those
characters from STRING in the range from (and including) the
character at the index START up to (but excluding) the character
This function returns a new string which consists of those
characters from STRING in the range from (and including) the
character at the index START up to (but excluding) the character
If the characters copied from STRING have duplicable extents or
text properties, those are copied into the new string also. *Note
If the characters copied from STRING have duplicable extents or
text properties, those are copied into the new string also. *Note
either integer is out of range for STRING.
Contrast this function with `buffer-substring' (*note Buffer
either integer is out of range for STRING.
Contrast this function with `buffer-substring' (*note Buffer
text in the current buffer. The beginning of a string is at index
0, but the beginning of a buffer is at index 1.
text in the current buffer. The beginning of a string is at index
0, but the beginning of a buffer is at index 1.
This function returns a new string consisting of the characters in
the arguments passed to it (along with their text properties, if
any). The arguments may be strings, lists of numbers, or vectors
This function returns a new string consisting of the characters in
the arguments passed to it (along with their text properties, if
any). The arguments may be strings, lists of numbers, or vectors
representation of the integer. *Don't use this feature; we plan
to eliminate it. If you already use this feature, change your
programs now!* The proper way to convert an integer to a decimal
representation of the integer. *Don't use this feature; we plan
to eliminate it. If you already use this feature, change your
programs now!* The proper way to convert an integer to a decimal
- number in this way is with `format' (*note Formatting Strings::.)
- or `number-to-string' (*note String Conversion::.).
+ number in this way is with `format' (*note Formatting Strings::) or
+ `number-to-string' (*note String Conversion::).
This function returns `t' if OBJECT is a character.
Some functions that work on integers (e.g. the comparison functions
This function returns `t' if OBJECT is a character.
Some functions that work on integers (e.g. the comparison functions
in the future; therefore, do not rely on them. Instead, convert
the characters explicitly using `char-int'.
in the future; therefore, do not rely on them. Instead, convert
the characters explicitly using `char-int'.
This function converts a character into an equivalent integer.
The resulting integer will always be non-negative. The integers in
the range 0 - 255 map to characters as follows:
This function converts a character into an equivalent integer.
The resulting integer will always be non-negative. The integers in
the range 0 - 255 map to characters as follows:
XEmacs, the order in which character sets were loaded, etc., and
you should not depend on them.
XEmacs, the order in which character sets were loaded, etc., and
you should not depend on them.
This function converts an integer into the equivalent character.
Not all integers correspond to valid characters; use `char-int-p'
to determine whether this is the case. If the integer cannot be
converted, `nil' is returned.
This function converts an integer into the equivalent character.
Not all integers correspond to valid characters; use `char-int-p'
to determine whether this is the case. If the integer cannot be
converted, `nil' is returned.
This function returns `t' if the arguments represent the same
character, `nil' otherwise. This function ignores differences in
This function returns `t' if the arguments represent the same
character, `nil' otherwise. This function ignores differences in
This function returns `t' if the arguments represent the same
character, `nil' otherwise. Case is significant.
This function returns `t' if the arguments represent the same
character, `nil' otherwise. Case is significant.
This function compares two strings a character at a time. First it
scans both the strings at once to find the first pair of
corresponding characters that do not match. If the lesser
This function compares two strings a character at a time. First it
scans both the strings at once to find the first pair of
corresponding characters that do not match. If the lesser
`string-lessp' is another name for `string<'.
See also `compare-buffer-substrings' in *Note Comparing Text::, for
`string-lessp' is another name for `string<'.
See also `compare-buffer-substrings' in *Note Comparing Text::, for
This section describes functions for conversions between characters,
strings and integers. `format' and `prin1-to-string' (*note Output
This section describes functions for conversions between characters,
strings and integers. `format' and `prin1-to-string' (*note Output
-Functions::.) can also convert Lisp objects into strings.
-`read-from-string' (*note Input Functions::.) can "convert" a string
+Functions::) can also convert Lisp objects into strings.
+`read-from-string' (*note Input Functions::) can "convert" a string
representation of a Lisp object into an object.
*Note Documentation::, for functions that produce textual
representation of a Lisp object into an object.
*Note Documentation::, for functions that produce textual
(`single-key-description' and `text-char-description'). These
functions are used primarily for making help messages.
(`single-key-description' and `text-char-description'). These
functions are used primarily for making help messages.
This function returns a new string with a length of one character.
The value of CHARACTER, modulo 256, is used to initialize the
element of the string.
This function returns a new string with a length of one character.
The value of CHARACTER, modulo 256, is used to initialize the
element of the string.
This function returns the first character in STRING. If the
string is empty, the function returns 0. (Under XEmacs 19, the
value is also 0 when the first character of STRING is the null
This function returns the first character in STRING. If the
string is empty, the function returns 0. (Under XEmacs 19, the
value is also 0 when the first character of STRING is the null
This function returns a string consisting of the printed
representation of NUMBER, which may be an integer or a floating
point number. The value starts with a sign if the argument is
This function returns a string consisting of the printed
representation of NUMBER, which may be an integer or a floating
point number. The value starts with a sign if the argument is
- - Function: string-to-number STRING &optional BASE
- This function returns the numeric value of the characters in
- STRING, read in BASE. It skips spaces and tabs at the beginning
- of STRING, then reads as much of STRING as it can interpret as a
+ - Function: string-to-number string &optional base
+ This function returns the numeric value represented by STRING,
+ read in BASE. It skips spaces and tabs at the beginning of
+ STRING, then reads as much of STRING as it can interpret as a
- beginning, not just spaces and tabs.) If the first character after
- the ignored whitespace is not a digit or a minus sign, this
+ beginning, not just spaces and tabs.) If the first character
+ after the ignored whitespace is not a digit or a minus sign, this
- Similar to symbols, extents, faces, and glyphs, you can attach
+ Just as with symbols, extents, faces, and glyphs, you can attach
additional information to strings in the form of "string properties".
These differ from text properties, which are logically attached to
particular characters in the string.
To attach a property to a string, use `put'. To retrieve a property
from a string, use `get'. You can also use `remprop' to remove a
additional information to strings in the form of "string properties".
These differ from text properties, which are logically attached to
particular characters in the string.
To attach a property to a string, use `put'. To retrieve a property
from a string, use `get'. You can also use `remprop' to remove a
formatting feature described here; they differ from `format' only in
how they use the result of formatting.
formatting feature described here; they differ from `format' only in
how they use the result of formatting.
This function returns a new string that is made by copying STRING
and then replacing any format specification in the copy with
encodings of the corresponding OBJECTS. The arguments OBJECTS are
This function returns a new string that is made by copying STRING
and then replacing any format specification in the copy with
encodings of the corresponding OBJECTS. The arguments OBJECTS are
(format "The word `%7s' actually has %d letters in it."
"foo" (length "foo"))
=> "The word ` foo' actually has 3 letters in it."
(format "The word `%7s' actually has %d letters in it."
"foo" (length "foo"))
=> "The word ` foo' actually has 3 letters in it."
(format "The word `%7s' actually has %d letters in it."
"specification" (length "specification"))
=> "The word `specification' actually has 13 letters in it."
(format "The word `%7s' actually has %d letters in it."
"specification" (length "specification"))
=> "The word `specification' actually has 13 letters in it."
(format "The word `%-7s' actually has %d letters in it."
"foo" (length "foo"))
=> "The word `foo ' actually has 3 letters in it."
(format "The word `%-7s' actually has %d letters in it."
"foo" (length "foo"))
=> "The word `foo ' actually has 3 letters in it."
This function converts a character or a string to lower case.
When the argument to `downcase' is a string, the function creates
This function converts a character or a string to lower case.
When the argument to `downcase' is a string, the function creates
XEmacs 19.) If the original character is lower case, or is not a
letter, then the value equals the original character.
XEmacs 19.) If the original character is lower case, or is not a
letter, then the value equals the original character.
This function converts a character or a string to upper case.
When the argument to `upcase' is a string, the function creates
This function converts a character or a string to upper case.
When the argument to `upcase' is a string, the function creates
This function capitalizes strings or characters. If
STRING-OR-CHAR is a string, the function creates and returns a new
string, whose contents are a copy of STRING-OR-CHAR in which each
This function capitalizes strings or characters. If
STRING-OR-CHAR is a string, the function creates and returns a new
string, whose contents are a copy of STRING-OR-CHAR in which each
The definition of a word is any sequence of consecutive characters
that are assigned to the word constituent syntax class in the
The definition of a word is any sequence of consecutive characters
that are assigned to the word constituent syntax class in the
When the argument to `capitalize' is a character, `capitalize' has
the same result as `upcase'.
When the argument to `capitalize' is a character, `capitalize' has
the same result as `upcase'.
table". A case table specifies the mapping between upper case and lower
case letters. It affects both the string and character case conversion
functions (see the previous section) and those that apply to text in the
table". A case table specifies the mapping between upper case and lower
case letters. It affects both the string and character case conversion
functions (see the previous section) and those that apply to text in the
-buffer (*note Case Changes::.). You need a case table if you are using
-a language which has letters other than the standard ASCII letters.
+buffer (*note Case Changes::). You need a case table if you are using a
+language which has letters other than the standard ASCII letters.
- - Function: set-standard-case-table TABLE
- This function makes TABLE the standard case table, so that it will
- apply to any buffers created subsequently.
+ - Function: set-standard-case-table case-table
+ This function makes CASE-TABLE the standard case table, so that it
+ will apply to any buffers created subsequently.
- - Function: current-case-table
- This function returns the current buffer's case table.
+ - Function: current-case-table &optional buffer
+ This function returns the case table of BUFFER, which defaults to
+ the current buffer.
The following three functions are convenient subroutines for packages
that define non-ASCII character sets. They modify a string
The following three functions are convenient subroutines for packages
that define non-ASCII character sets. They modify a string
used as the DOWNCASE part of a case table. They also modify the
standard syntax table. *Note Syntax Tables::.
used as the DOWNCASE part of a case table. They also modify the
standard syntax table. *Note Syntax Tables::.
This function makes CHAR case-invariant, with syntax SYNTAX.
- Command: describe-buffer-case-table
This function makes CHAR case-invariant, with syntax SYNTAX.
- Command: describe-buffer-case-table
character. Higher-level Lisp functions are provided for working
with syntax tables. The valid values are integers.
character. Higher-level Lisp functions are provided for working
with syntax tables. The valid values are integers.
This function makes a new, empty char table of type TYPE. TYPE
should be a symbol, one of `char', `category', `display',
`generic', or `syntax'.
This function makes a new, empty char table of type TYPE. TYPE
should be a symbol, one of `char', `category', `display',
`generic', or `syntax'.
- - Function: put-char-table RANGE VAL TABLE
- This function sets the value for chars in RANGE to be VAL in TABLE.
+ - Function: put-char-table range value char-table
+ This function sets the value for chars in RANGE to be VALUE in
+ CHAR-TABLE.
- - Function: get-range-char-table RANGE TABLE &optional MULTI
- This function finds the value for a range in TABLE. If there is
- more than one value, MULTI is returned (defaults to `nil').
+ - Function: get-range-char-table range char-table &optional multi
+ This function finds the value for a range in CHAR-TABLE. If there
+ is more than one value, MULTI is returned (defaults to `nil').
- - Function: map-char-table FUNCTION TABLE &optional RANGE
- This function maps FUNCTION over entries in TABLE, calling it with
- two args, each key and value in the table.
+ - Function: map-char-table function char-table &optional range
+ This function maps FUNCTION over entries in CHAR-TABLE, calling it
+ with two args, each key and value in the table.
RANGE specifies a subrange to map over and is in the same format
as the RANGE argument to `put-range-table'. If omitted or `t', it
defaults to the entire table.
RANGE specifies a subrange to map over and is in the same format
as the RANGE argument to `put-range-table'. If omitted or `t', it
defaults to the entire table.
`nil'. (Many of these predicates can be defined in terms of the
others, but they are used so often that it is worth having all of them.)
`nil'. (Many of these predicates can be defined in terms of the
others, but they are used so often that it is worth having all of them.)
This function returns `t' if OBJECT is an atom, `nil' otherwise.
All objects except cons cells are atoms. The symbol `nil' is an
atom and is also a list; it is the only Lisp object that is both.
(atom OBJECT) == (not (consp OBJECT))
This function returns `t' if OBJECT is an atom, `nil' otherwise.
All objects except cons cells are atoms. The symbol `nil' is an
atom and is also a list; it is the only Lisp object that is both.
(atom OBJECT) == (not (consp OBJECT))
This function returns `t' if OBJECT is a cons cell or `nil'.
Otherwise, it returns `nil'.
This function returns `t' if OBJECT is a cons cell or `nil'.
Otherwise, it returns `nil'.
This function is the opposite of `listp': it returns `t' if OBJECT
is not a list. Otherwise, it returns `nil'.
(listp OBJECT) == (not (nlistp OBJECT))
This function is the opposite of `listp': it returns `t' if OBJECT
is not a list. Otherwise, it returns `nil'.
(listp OBJECT) == (not (nlistp OBJECT))
This function returns `t' if OBJECT is `nil', and returns `nil'
otherwise. This function is identical to `not', but as a matter
of clarity we use `null' when OBJECT is considered a list and
This function returns `t' if OBJECT is `nil', and returns `nil'
otherwise. This function is identical to `not', but as a matter
of clarity we use `null' when OBJECT is considered a list and