summaryrefslogtreecommitdiff
path: root/devdocs/elisp/string-basics.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/elisp/string-basics.html')
-rw-r--r--devdocs/elisp/string-basics.html6
1 files changed, 6 insertions, 0 deletions
diff --git a/devdocs/elisp/string-basics.html b/devdocs/elisp/string-basics.html
new file mode 100644
index 00000000..8c56004d
--- /dev/null
+++ b/devdocs/elisp/string-basics.html
@@ -0,0 +1,6 @@
+ <h3 class="section">String and Character Basics</h3> <p>A character is a Lisp object which represents a single character of text. In Emacs Lisp, characters are simply integers; whether an integer is a character or not is determined only by how it is used. See <a href="character-codes">Character Codes</a>, for details about character representation in Emacs. </p> <p>A string is a fixed sequence of characters. It is a type of sequence called a <em>array</em>, meaning that its length is fixed and cannot be altered once it is created (see <a href="sequences-arrays-vectors">Sequences Arrays Vectors</a>). Unlike in C, Emacs Lisp strings are <em>not</em> terminated by a distinguished character code. </p> <p>Since strings are arrays, and therefore sequences as well, you can operate on them with the general array and sequence functions documented in <a href="sequences-arrays-vectors">Sequences Arrays Vectors</a>. For example, you can access individual characters in a string using the function <code>aref</code> (see <a href="array-functions">Array Functions</a>). </p> <p>There are two text representations for non-<acronym>ASCII</acronym> characters in Emacs strings (and in buffers): unibyte and multibyte. For most Lisp programming, you don’t need to be concerned with these two representations. See <a href="text-representations">Text Representations</a>, for details. </p> <p>Sometimes key sequences are represented as unibyte strings. When a unibyte string is a key sequence, string elements in the range 128 to 255 represent meta characters (which are large integers) rather than character codes in the range 128 to 255. Strings cannot hold characters that have the hyper, super or alt modifiers; they can hold <acronym>ASCII</acronym> control characters, but no other control characters. They do not distinguish case in <acronym>ASCII</acronym> control characters. If you want to store such characters in a sequence, such as a key sequence, you must use a vector instead of a string. See <a href="character-type">Character Type</a>, for more information about keyboard input characters. </p> <p>Strings are useful for holding regular expressions. You can also match regular expressions against strings with <code>string-match</code> (see <a href="regexp-search">Regexp Search</a>). The functions <code>match-string</code> (see <a href="simple-match-data">Simple Match Data</a>) and <code>replace-match</code> (see <a href="replacing-match">Replacing Match</a>) are useful for decomposing and modifying strings after matching regular expressions against them. </p> <p>Like a buffer, a string can contain text properties for the characters in it, as well as the characters themselves. See <a href="text-properties">Text Properties</a>. All the Lisp primitives that copy text from strings to buffers or other strings also copy the properties of the characters being copied. </p> <p>See <a href="text">Text</a>, for information about functions that display strings or copy them into buffers. See <a href="character-type">Character Type</a>, and <a href="string-type">String Type</a>, for information about the syntax of characters and strings. See <a href="non_002dascii-characters">Non-ASCII Characters</a>, for functions to convert between text representations and to encode and decode character codes. Also, note that <code>length</code> should <em>not</em> be used for computing the width of a string on display; use <code>string-width</code> (see <a href="size-of-displayed-text">Size of Displayed Text</a>) instead. </p><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/String-Basics.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/String-Basics.html</a>
+ </p>
+</div>