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 |
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 |
7 |
@node Strings and Characters, Lists, Numbers, Top |
@node Strings and Characters, Lists, Numbers, Top |
158 |
is 3 is actually the fourth character in the string. |
is 3 is actually the fourth character in the string. |
159 |
|
|
160 |
A negative number counts from the end of the string, so that @minus{}1 |
A negative number counts from the end of the string, so that @minus{}1 |
161 |
signifies the index of the last character of the string. For example: |
signifies the index of the last character of the string. For example: |
162 |
|
|
163 |
@example |
@example |
164 |
@group |
@group |
410 |
(string< "abc" "ab") |
(string< "abc" "ab") |
411 |
@result{} nil |
@result{} nil |
412 |
(string< "" "") |
(string< "" "") |
413 |
@result{} nil |
@result{} nil |
414 |
@end group |
@end group |
415 |
@end example |
@end example |
416 |
@end defun |
@end defun |
597 |
|
|
598 |
@defun format string &rest objects |
@defun format string &rest objects |
599 |
This function returns a new string that is made by copying |
This function returns a new string that is made by copying |
600 |
@var{string} and then replacing any format specification |
@var{string} and then replacing any format specification |
601 |
in the copy with encodings of the corresponding @var{objects}. The |
in the copy with encodings of the corresponding @var{objects}. The |
602 |
arguments @var{objects} are the computed values to be formatted. |
arguments @var{objects} are the computed values to be formatted. |
603 |
|
|
707 |
(format "The buffer object prints as %s." (current-buffer)) |
(format "The buffer object prints as %s." (current-buffer)) |
708 |
@result{} "The buffer object prints as strings.texi." |
@result{} "The buffer object prints as strings.texi." |
709 |
|
|
710 |
(format "The octal value of %d is %o, |
(format "The octal value of %d is %o, |
711 |
and the hex value is %x." 18 18 18) |
and the hex value is %x." 18 18 18) |
712 |
@result{} "The octal value of 18 is 22, |
@result{} "The octal value of 18 is 22, |
713 |
and the hex value is 12." |
and the hex value is 12." |
714 |
@end group |
@end group |
715 |
@end example |
@end example |
745 |
second case, the string @code{"specification"} is 13 letters wide but is |
second case, the string @code{"specification"} is 13 letters wide but is |
746 |
not truncated. In the third case, the padding is on the right. |
not truncated. In the third case, the padding is on the right. |
747 |
|
|
748 |
@smallexample |
@smallexample |
749 |
@group |
@group |
750 |
(format "The word `%7s' actually has %d letters in it." |
(format "The word `%7s' actually has %d letters in it." |
751 |
"foo" (length "foo")) |
"foo" (length "foo")) |
752 |
@result{} "The word ` foo' actually has 3 letters in it." |
@result{} "The word ` foo' actually has 3 letters in it." |
753 |
@end group |
@end group |
754 |
|
|
755 |
@group |
@group |
756 |
(format "The word `%7s' actually has %d letters in it." |
(format "The word `%7s' actually has %d letters in it." |
757 |
"specification" (length "specification")) |
"specification" (length "specification")) |
758 |
@result{} "The word `specification' actually has 13 letters in it." |
@result{} "The word `specification' actually has 13 letters in it." |
759 |
@end group |
@end group |
760 |
|
|
761 |
@group |
@group |
762 |
(format "The word `%-7s' actually has %d letters in it." |
(format "The word `%-7s' actually has %d letters in it." |
763 |
"foo" (length "foo")) |
"foo" (length "foo")) |
764 |
@result{} "The word `foo ' actually has 3 letters in it." |
@result{} "The word `foo ' actually has 3 letters in it." |
765 |
@end group |
@end group |
766 |
@end smallexample |
@end smallexample |
767 |
|
|
768 |
@node Case Conversion |
@node Case Conversion |
769 |
@comment node-name, next, previous, up |
@comment node-name, next, previous, up |
770 |
@section Case Conversion in Lisp |
@section Case Conversion in Lisp |
771 |
@cindex upper case |
@cindex upper case |
772 |
@cindex lower case |
@cindex lower case |
773 |
@cindex character case |
@cindex character case |
774 |
@cindex case conversion in Lisp |
@cindex case conversion in Lisp |
775 |
|
|
776 |
The character case functions change the case of single characters or |
The character case functions change the case of single characters or |