1 |
@c -*-texinfo-*- |
@c -*-texinfo-*- |
2 |
@c This is part of the GNU Emacs Lisp Reference Manual. |
@c This is part of the GNU Emacs Lisp Reference Manual. |
3 |
@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 |
@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2003 |
4 |
@c Free Software Foundation, Inc. |
@c Free Software Foundation, Inc. |
5 |
@c See the file elisp.texi for copying conditions. |
@c See the file elisp.texi for copying conditions. |
6 |
@setfilename ../info/strings |
@setfilename ../info/strings |
219 |
beginning of a buffer is at index 1. |
beginning of a buffer is at index 1. |
220 |
@end defun |
@end defun |
221 |
|
|
222 |
|
@defun substring-no-properties string start &optional end |
223 |
|
This works like @code{substring} but discards all text properties |
224 |
|
from the value. |
225 |
|
@end defun |
226 |
|
|
227 |
@defun concat &rest sequences |
@defun concat &rest sequences |
228 |
@cindex copying strings |
@cindex copying strings |
229 |
@cindex concatenating strings |
@cindex concatenating strings |
260 |
|
|
261 |
For information about other concatenation functions, see the |
For information about other concatenation functions, see the |
262 |
description of @code{mapconcat} in @ref{Mapping Functions}, |
description of @code{mapconcat} in @ref{Mapping Functions}, |
263 |
@code{vconcat} in @ref{Vectors}, and @code{append} in @ref{Building |
@code{vconcat} in @ref{Vector Functions}, and @code{append} in @ref{Building |
264 |
Lists}. |
Lists}. |
265 |
@end defun |
@end defun |
266 |
|
|
267 |
@defun split-string string separators |
@defun split-string string separators omit-nulls |
268 |
This function splits @var{string} into substrings at matches for the regular |
This function splits @var{string} into substrings at matches for the |
269 |
expression @var{separators}. Each match for @var{separators} defines a |
regular expression @var{separators}. Each match for @var{separators} |
270 |
splitting point; the substrings between the splitting points are made |
defines a splitting point; the substrings between the splitting points |
271 |
into a list, which is the value returned by @code{split-string}. |
are made into a list, which is the value returned by |
272 |
|
@code{split-string}. |
273 |
|
|
274 |
|
If @var{omit-nulls} is @code{nil}, the result contains null strings |
275 |
|
whenever there are two consecutive matches for @var{separators}, or a |
276 |
|
match is adjacent to the beginning or end of @var{string}. If |
277 |
|
@var{omit-nulls} is @code{t}, these null strings are omitted from the |
278 |
|
result list. |
279 |
|
|
280 |
If @var{separators} is @code{nil} (or omitted), |
If @var{separators} is @code{nil} (or omitted), |
281 |
the default is @code{"[ \f\t\n\r\v]+"}. |
the default is the value of @code{split-string-default-separators}. |
282 |
|
|
283 |
For example, |
As a special case, when @var{separators} is @code{nil} (or omitted), |
284 |
|
null strings are always omitted from the result. Thus: |
285 |
|
|
286 |
@example |
@example |
287 |
(split-string "Soup is good food" "o") |
(split-string " two words ") |
288 |
@result{} ("S" "up is g" "" "d f" "" "d") |
@result{} ("two" "words") |
289 |
(split-string "Soup is good food" "o+") |
@end example |
290 |
@result{} ("S" "up is g" "d f" "d") |
|
291 |
|
The result is not @samp{("" "two" "words" "")}, which would rarely be |
292 |
|
useful. If you need such a result, use an explict value for |
293 |
|
@var{separators}: |
294 |
|
|
295 |
|
@example |
296 |
|
(split-string " two words " split-string-default-separators) |
297 |
|
@result{} ("" "two" "words" "") |
298 |
@end example |
@end example |
299 |
|
|
300 |
When there is a match adjacent to the beginning or end of the string, |
More examples: |
|
this does not cause a null string to appear at the beginning or end |
|
|
of the list: |
|
301 |
|
|
302 |
@example |
@example |
303 |
(split-string "out to moo" "o+") |
(split-string "Soup is good food" "o") |
304 |
@result{} ("ut t" " m") |
@result{} ("S" "up is g" "" "d f" "" "d") |
305 |
|
(split-string "Soup is good food" "o" t) |
306 |
|
@result{} ("S" "up is g" "d f" "d") |
307 |
|
(split-string "Soup is good food" "o+") |
308 |
|
@result{} ("S" "up is g" "d f" "d") |
309 |
@end example |
@end example |
310 |
|
|
311 |
Empty matches do count, when not adjacent to another match: |
Empty matches do count, when not adjacent to another match: |
318 |
@end example |
@end example |
319 |
@end defun |
@end defun |
320 |
|
|
321 |
|
@defvar split-string-default-separators |
322 |
|
The default value of @var{separators} for @code{split-string}, initially |
323 |
|
@samp{"[ \f\t\n\r\v]+"}. |
324 |
|
@end defvar |
325 |
|
|
326 |
@node Modifying Strings |
@node Modifying Strings |
327 |
@section Modifying Strings |
@section Modifying Strings |
328 |
|
|
1012 |
This command displays a description of the contents of the current |
This command displays a description of the contents of the current |
1013 |
buffer's case table. |
buffer's case table. |
1014 |
@end deffn |
@end deffn |
1015 |
|
|
1016 |
|
@ignore |
1017 |
|
arch-tag: 700b8e95-7aa5-4b52-9eb3-8f2e1ea152b4 |
1018 |
|
@end ignore |