Merge from emacs-23; up to 2010-06-12T11:17:12Z!eliz@gnu.org.
[bpt/emacs.git] / doc / lispref / strings.texi
index 5dd5e80..05ac40e 100644 (file)
@@ -1,7 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001,
-@c   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
+@c Copyright (C) 1990-1995, 1998-1999, 2001-2011
+@c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../../info/strings
 @node Strings and Characters, Lists, Numbers, Top
@@ -31,7 +31,7 @@ keyboard character events.
 * String Conversion::         Converting to and from characters and strings.
 * Formatting Strings::        @code{format}: Emacs's analogue of @code{printf}.
 * Case Conversion::           Case conversion functions.
-* Case Tables::                      Customizing case conversion.
+* Case Tables::               Customizing case conversion.
 @end menu
 
 @node String Basics
@@ -125,9 +125,8 @@ This function returns a string made up of @var{count} repetitions of
      @result{} ""
 @end example
 
-  Other functions to compare with this one include @code{char-to-string}
-(@pxref{String Conversion}), @code{make-vector} (@pxref{Vectors}), and
-@code{make-list} (@pxref{Building Lists}).
+  Other functions to compare with this one include @code{make-vector}
+(@pxref{Vectors}) and @code{make-list} (@pxref{Building Lists}).
 @end defun
 
 @defun string &rest characters
@@ -155,9 +154,9 @@ index @var{start} up to (but excluding) the character at the index
 @noindent
 In the above example, the index for @samp{a} is 0, the index for
 @samp{b} is 1, and the index for @samp{c} is 2.  The index 3---which
-is the the fourth character in the string---marks the character
-position up to which the substring is copied.  Thus, @samp{abc} is
-copied from the string @code{"abcdefg"}.
+is the fourth character in the string---marks the character position
+up to which the substring is copied.  Thus, @samp{abc} is copied from
+the string @code{"abcdefg"}.
 
 A negative number counts from the end of the string, so that @minus{}1
 signifies the index of the last character of the string.  For example:
@@ -348,9 +347,9 @@ practice:
      @result{} ("o" "o" "o")
 @end example
 
-If you need to split a string that is a shell command, where
-individual arguments could be quoted, see @ref{Shell Arguments,
-split-string-and-unquote}.
+If you need to split a string into a list of individual command-line
+arguments suitable for @code{call-process} or @code{start-process},
+see @ref{Shell Arguments, split-string-and-unquote}.
 @end defun
 
 @defvar split-string-default-separators
@@ -555,8 +554,8 @@ strings and integers.  @code{format} (@pxref{Formatting Strings}) and
 @code{prin1-to-string} (@pxref{Output Functions}) can also convert
 Lisp objects into strings.  @code{read-from-string} (@pxref{Input
 Functions}) can ``convert'' a string representation of a Lisp object
-into an object.  The functions @code{string-make-multibyte} and
-@code{string-make-unibyte} convert the text representation of a string
+into an object.  The functions @code{string-to-multibyte} and
+@code{string-to-unibyte} convert the text representation of a string
 (@pxref{Converting Representations}).
 
   @xref{Documentation}, for functions that produce textual descriptions
@@ -564,38 +563,6 @@ of text characters and general input events
 (@code{single-key-description} and @code{text-char-description}).  These
 are used primarily for making help messages.
 
-@defun char-to-string character
-@cindex character to string
-This function returns a new string containing one character,
-@var{character}.  This function is semi-obsolete because the function
-@code{string} is more general.  @xref{Creating Strings}.
-@end defun
-
-@defun string-to-char string
-@cindex string to character
-  This function returns the first character in @var{string}.  If the
-string is empty, the function returns 0.  The value is also 0 when the
-first character of @var{string} is the null character, @acronym{ASCII} code
-0.
-
-@example
-(string-to-char "ABC")
-     @result{} 65
-
-(string-to-char "xyz")
-     @result{} 120
-(string-to-char "")
-     @result{} 0
-@group
-(string-to-char "\000")
-     @result{} 0
-@end group
-@end example
-
-This function may be eliminated in the future if it does not seem useful
-enough to retain.
-@end defun
-
 @defun number-to-string number
 @cindex integer to string
 @cindex integer to decimal
@@ -656,21 +623,41 @@ this function returns 0.
 
 @findex string-to-int
 @code{string-to-int} is an obsolete alias for this function.
+@end defun
+
+@defun char-to-string character
+@cindex character to string
+This function returns a new string containing one character,
+@var{character}.  This function is semi-obsolete because the function
+@code{string} is more general.  @xref{Creating Strings}.
+@end defun
+
+@defun string-to-char string
+  This function returns the first character in @var{string}.  This
+mostly identical to @code{(aref string 0)}, except that it returns 0
+if the string is empty.  (The value is also 0 when the first character
+of @var{string} is the null character, @acronym{ASCII} code 0.)  This
+function may be eliminated in the future if it does not seem useful
+enough to retain.
 @end defun
 
   Here are some other functions that can convert to or from a string:
 
 @table @code
 @item concat
-@code{concat} can convert a vector or a list into a string.
+This function converts a vector or a list into a string.
 @xref{Creating Strings}.
 
 @item vconcat
-@code{vconcat} can convert a string into a vector.  @xref{Vector
+This function converts a string into a vector.  @xref{Vector
 Functions}.
 
 @item append
-@code{append} can convert a string into a list.  @xref{Building Lists}.
+This function converts a string into a list.  @xref{Building Lists}.
+
+@item byte-to-string
+This function converts a byte of character data into a unibyte string.
+@xref{Converting Representations}.
 @end table
 
 @node Formatting Strings
@@ -841,12 +828,12 @@ is not truncated.
 
 @example
 @group
-(format "The word `%7s' actually has %d letters in it."
+(format "The word `%7s' has %d letters in it."
         "foo" (length "foo"))
-     @result{} "The word `    foo' actually has 3 letters in it."
-(format "The word `%7s' actually has %d letters in it."
+     @result{} "The word `    foo' has 3 letters in it."
+(format "The word `%7s' has %d letters in it."
         "specification" (length "specification"))
-     @result{} "The word `specification' actually has 13 letters in it."
+     @result{} "The word `specification' has 13 letters in it."
 @end group
 @end example
 
@@ -952,7 +939,7 @@ character or a string, to upper case.
 When @var{string-or-char} is a string, this function returns a new
 string in which each letter in the argument that is lower case is
 converted to upper case.  When @var{string-or-char} is a character,
-this function returns the corresponding upper case character (an an
+this function returns the corresponding upper case character (an
 integer); if the original character is upper case, or is not a letter,
 the return value is equal to the original character.
 
@@ -1154,7 +1141,3 @@ This function makes @var{char} case-invariant, with syntax
 This command displays a description of the contents of the current
 buffer's case table.
 @end deffn
-
-@ignore
-   arch-tag: 700b8e95-7aa5-4b52-9eb3-8f2e1ea152b4
-@end ignore