Mercurial > emacs
comparison lispref/strings.texi @ 53434:6fddc60d9cbc
(Modifying Strings): Add clear-string.
(Text Comparison): Add assoc-string and remove
assoc-ignore-case, assoc-ignore-representation.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 29 Dec 2003 21:37:17 +0000 |
parents | 917e6aba04d3 |
children | 4f06a8a0e7a6 |
comparison
equal
deleted
inserted
replaced
53433:5bf3c4457aa3 | 53434:6fddc60d9cbc |
---|---|
375 | 375 |
376 Since it is impossible to change the length of an existing string, it is | 376 Since it is impossible to change the length of an existing string, it is |
377 an error if @var{obj} doesn't fit within @var{string}'s actual length, | 377 an error if @var{obj} doesn't fit within @var{string}'s actual length, |
378 or if any new character requires a different number of bytes from the | 378 or if any new character requires a different number of bytes from the |
379 character currently present at that point in @var{string}. | 379 character currently present at that point in @var{string}. |
380 @end defun | |
381 | |
382 To clear out a string that contained a password, use | |
383 @code{clear-string}: | |
384 | |
385 @defun clear-string string | |
386 This clears the contents of @var{string} to zeros | |
387 and may change its length. | |
380 @end defun | 388 @end defun |
381 | 389 |
382 @need 2000 | 390 @need 2000 |
383 @node Text Comparison | 391 @node Text Comparison |
384 @section Comparison of Characters and Strings | 392 @section Comparison of Characters and Strings |
516 is one plus the number of characters that agree at the beginning of the | 524 is one plus the number of characters that agree at the beginning of the |
517 two strings. The sign is negative if @var{string1} (or its specified | 525 two strings. The sign is negative if @var{string1} (or its specified |
518 portion) is less. | 526 portion) is less. |
519 @end defun | 527 @end defun |
520 | 528 |
521 @defun assoc-ignore-case key alist | 529 @defun assoc-string key alist &optional case-fold |
522 @defunx assoc-ignore-representation key alist | 530 This function works like @code{assoc}, except that @var{key} must be a |
523 These functions work like @code{assoc}, except that @var{key} must be | 531 string, and comparison is done using @code{compare-strings}. If |
524 a string, all elements of @var{alist} must be cons cells whose | 532 @var{case-fold} is non-@code{nil}, it ignores case differences. |
525 @sc{car} is a string, and comparison is done using | |
526 @code{compare-strings}. @code{assoc-ignore-case} ignores case | |
527 differences, whereas @code{assoc-ignore-representation} does not. | |
528 @xref{Association Lists}. | 533 @xref{Association Lists}. |
529 @end defun | 534 @end defun |
530 | 535 |
531 See also @code{compare-buffer-substrings} in @ref{Comparing Text}, for | 536 See also @code{compare-buffer-substrings} in @ref{Comparing Text}, for |
532 a way to compare text in buffers. The function @code{string-match}, | 537 a way to compare text in buffers. The function @code{string-match}, |