Mercurial > hg > xemacs-beta
comparison man/lispref/strings.texi @ 280:7df0dd720c89 r21-0b38
Import from CVS: tag r21-0b38
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:32:22 +0200 |
parents | fe104dbd9147 |
children | 558f606b08ae |
comparison
equal
deleted
inserted
replaced
279:c20b2fb5bb0a | 280:7df0dd720c89 |
---|---|
112 @end defun | 112 @end defun |
113 | 113 |
114 @defun char-or-string-p object | 114 @defun char-or-string-p object |
115 This function returns @code{t} if @var{object} is a string or a | 115 This function returns @code{t} if @var{object} is a string or a |
116 character, @code{nil} otherwise. | 116 character, @code{nil} otherwise. |
117 | |
118 In XEmacs addition, this function also returns @code{t} if @var{object} | |
119 is an integer that can be represented as a character. This is because | |
120 of compatibility with previous XEmacs and should not be depended on. | |
117 @end defun | 121 @end defun |
118 | 122 |
119 @node Creating Strings | 123 @node Creating Strings |
120 @section Creating Strings | 124 @section Creating Strings |
121 | 125 |
122 The following functions create strings, either from scratch, or by | 126 The following functions create strings, either from scratch, or by |
123 putting strings together, or by taking them apart. | 127 putting strings together, or by taking them apart. |
128 | |
129 @defun string &rest characters | |
130 This function returns of string made up of @var{characters}. | |
131 | |
132 @example | |
133 (string ?X ?E ?m ?a ?c ?s) | |
134 @result{} "XEmacs" | |
135 (string) | |
136 @result{} "" | |
137 @end example | |
138 | |
139 Analogous functions operating on other data types include @code{list}, | |
140 @code{cons} (@pxref{Building Lists}), @code{vector} (@pxref{Vectors}) | |
141 and @code{bit-vector} (@pxref{Bit Vectors}). This function has not been | |
142 available in XEmacs prior to 21.0 and FSF Emacs prior to 20.3. | |
143 @end defun | |
124 | 144 |
125 @defun make-string count character | 145 @defun make-string count character |
126 This function returns a string made up of @var{count} repetitions of | 146 This function returns a string made up of @var{count} repetitions of |
127 @var{character}. If @var{count} is negative, an error is signaled. | 147 @var{character}. If @var{count} is negative, an error is signaled. |
128 | 148 |
536 @code{int-to-string} is a semi-obsolete alias for this function. | 556 @code{int-to-string} is a semi-obsolete alias for this function. |
537 | 557 |
538 See also the function @code{format} in @ref{Formatting Strings}. | 558 See also the function @code{format} in @ref{Formatting Strings}. |
539 @end defun | 559 @end defun |
540 | 560 |
541 @defun string-to-number string | 561 @defun string-to-number string &optional base |
542 @cindex string to number | 562 @cindex string to number |
543 This function returns the numeric value of the characters in | 563 This function returns the numeric value of the characters in |
544 @var{string}, read in base ten. It skips spaces and tabs at the | 564 @var{string}, read in @var{base}. It skips spaces and tabs at the |
545 beginning of @var{string}, then reads as much of @var{string} as it can | 565 beginning of @var{string}, then reads as much of @var{string} as it can |
546 interpret as a number. (On some systems it ignores other whitespace at | 566 interpret as a number. (On some systems it ignores other whitespace at |
547 the beginning, not just spaces and tabs.) If the first character after | 567 the beginning, not just spaces and tabs.) If the first character after |
548 the ignored whitespace is not a digit or a minus sign, this function | 568 the ignored whitespace is not a digit or a minus sign, this function |
549 returns 0. | 569 returns 0. |
570 | |
571 If @var{base} is not specified, it defaults to ten. With @var{base} | |
572 other than ten, only integers can be read. | |
550 | 573 |
551 @example | 574 @example |
552 (string-to-number "256") | 575 (string-to-number "256") |
553 @result{} 256 | 576 @result{} 256 |
554 (string-to-number "25 is a perfect square.") | 577 (string-to-number "25 is a perfect square.") |
555 @result{} 25 | 578 @result{} 25 |
556 (string-to-number "X256") | 579 (string-to-number "X256") |
557 @result{} 0 | 580 @result{} 0 |
558 (string-to-number "-4.5") | 581 (string-to-number "-4.5") |
559 @result{} -4.5 | 582 @result{} -4.5 |
583 (string-to-number "ffff" 16) | |
584 @result{} 65535 | |
560 @end example | 585 @end example |
561 | 586 |
562 @findex string-to-int | 587 @findex string-to-int |
563 @code{string-to-int} is an obsolete alias for this function. | 588 @code{string-to-int} is an obsolete alias for this function. |
564 @end defun | 589 @end defun |
736 integer followed by a @samp{$}. | 761 integer followed by a @samp{$}. |
737 | 762 |
738 @item | 763 @item |
739 Zero or more of the optional flag characters @samp{-}, @samp{+}, | 764 Zero or more of the optional flag characters @samp{-}, @samp{+}, |
740 @samp{ }, @samp{0}, and @samp{#}. | 765 @samp{ }, @samp{0}, and @samp{#}. |
766 | |
767 @item | |
768 An asterisk (@samp{*}, meaning that the field width is now assumed to | |
769 have been specified as an argument. | |
741 | 770 |
742 @item | 771 @item |
743 An optional minimum field width. | 772 An optional minimum field width. |
744 | 773 |
745 @item | 774 @item |