-
Notifications
You must be signed in to change notification settings - Fork 0
/
chap-16.texi
862 lines (579 loc) · 25.2 KB
/
chap-16.texi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
@node Strings
@chapter Strings
@menu
* String Concepts::
* Strings Dictionary::
@end menu
@node String Concepts
@section String Concepts
@menu
* Implications of Strings Being Arrays::
* Subtypes of STRING::
@end menu
@node Implications of Strings Being Arrays
@subsection Implications of Strings Being Arrays
Since all @term{strings} are @term{arrays}, all rules which apply
generally to @term{arrays} also apply to @term{strings}.
See @ref{Array Concepts}.
For example,
@term{strings} can have @term{fill pointers},
and @term{strings} are also subject to the rules of @term{element type} @term{upgrading}
that apply to @term{arrays}.
@node Subtypes of STRING
@subsection Subtypes of STRING
All functions that operate on @term{strings}
will operate on @term{subtypes} of @term{string} as well.
However,
the consequences are undefined if a @term{character} is inserted into a @term{string}
for which the @term{element type} of the @term{string} does not include that @term{character}.
@node Strings Dictionary
@section Strings Dictionary
@menu
* string (System Class)::
* base-string::
* simple-string::
* simple-base-string::
* simple-string-p::
* char; schar::
* string (Function)::
* string-upcase; string-downcase; string-capitalize; nstring-upcase; nstr+::
* string-trim; string-left-trim; string-right-trim::
* string=; string/=; string<; string>; string<=; string>=; string-equal; +::
* stringp::
* make-string::
@end menu
@node string (System Class)
@syindexanchor{string, SC}
@subsection string (System Class)
@cindex string
@subsubheading Class Precedence List:
@symbolref{string, SC}
@symbolref{vector, SC},
@symbolref{array, SYM},
@symbolref{sequence, SYM},
@symbolref{t, SC}
@subsubheading Description:
A @term{string} is a @term{specialized} @term{vector}
whose @term{elements} are @oftypes{character}.
When used as a @term{type specifier} for object creation,
@symbolref{string, SC} means @f{(vector character)}.
@subsubheading Compound Type Specifier Kind:
Abbreviating.
@subsubheading Compound Type Specifier Syntax:
@Deftype{string, @ttbrac{size}}
@subsubheading Compound Type Specifier Arguments:
@param{size}---a non-negative @term{fixnum},
or the @term{symbol} @t{*}.
@subsubheading Compound Type Specifier Description:
This denotes the union of all @term{types}
@f{(array @i{c} (@param{size}))}
for all @term{subtypes} @i{c} of @symbolref{character, SC};
that is, the set of @term{strings} of size @param{size}.
@subsubheading See Also:
@ref{String Concepts},
@ref{Double-Quote},
@ref{Printing Strings}
@node base-string
@syindexanchor{base-string, SYM}
@subsection base-string (Type)
@cindex base-string
@subsubheading Supertypes:
@symbolref{base-string, SYM},
@symbolref{string, SC},
@symbolref{vector, SC},
@symbolref{array, SYM},
@symbolref{sequence, SYM},
@symbolref{t, SC}
@subsubheading Description:
@Thetype{base-string} is equivalent to
@f{(vector base-char)}.
The @term{base string} representation is the most efficient @term{string} representation
that can hold an arbitrary sequence of @term{standard characters}.
@subsubheading Compound Type Specifier Kind:
Abbreviating.
@subsubheading Compound Type Specifier Syntax:
@Deftype{base-string, @ttbrac{size}}
@subsubheading Compound Type Specifier Arguments:
@param{size}---a non-negative @term{fixnum},
or the @term{symbol} @t{*}.
@subsubheading Compound Type Specifier Description:
This is equivalent to the type @f{(vector base-char @param{size})};
that is, the set of @term{base strings} of size @param{size}.
@node simple-string
@syindexanchor{simple-string, SYM}
@subsection simple-string (Type)
@cindex simple-string
@subsubheading Supertypes:
@symbolref{simple-string, SYM},
@symbolref{string, SC},
@symbolref{vector, SC},
@symbolref{simple-array, SYM},
@symbolref{array, SYM},
@symbolref{sequence, SYM},
@symbolref{t, SC}
@subsubheading Description:
A @term{simple string} is a specialized one-dimensional
@term{simple array} whose @term{elements} are @oftypes{character}.
When used as a @term{type specifier} for object creation,
@symbolref{simple-string, SYM} means @f{(simple-array character (@i{size}))}.
@subsubheading Compound Type Specifier Kind:
Abbreviating.
@subsubheading Compound Type Specifier Syntax:
@Deftype{simple-string, @ttbrac{size}}
@subsubheading Compound Type Specifier Arguments:
@param{size}---a non-negative @term{fixnum},
or the @term{symbol} @t{*}.
@subsubheading Compound Type Specifier Description:
This denotes the union of all @term{types}
@tt{(simple-array @i{c} (@param{size}))} for all @term{subtypes} @i{c} of
@symbolref{character, SC}; that is, the set of @term{simple strings} of size @param{size}.
@node simple-base-string
@syindexanchor{simple-base-string, SYM}
@subsection simple-base-string (Type)
@cindex simple-base-string
@subsubheading Supertypes:
@symbolref{simple-base-string, SYM},
@symbolref{base-string, SYM},
@symbolref{simple-string, SYM},
@symbolref{string, SC},
@symbolref{vector, SC},
@symbolref{simple-array, SYM},
@symbolref{array, SYM},
@symbolref{sequence, SYM},
@symbolref{t, SC}
@subsubheading Description:
@Thetype{simple-base-string} is equivalent to
@f{(simple-array base-char (*))}.
@subsubheading Compound Type Specifier Kind:
Abbreviating.
@subsubheading Compound Type Specifier Syntax:
@Deftype{simple-base-string, @ttbrac{size}}
@subsubheading Compound Type Specifier Arguments:
@param{size}---a non-negative @term{fixnum},
or the @term{symbol} @t{*}.
@subsubheading Compound Type Specifier Description:
This is equivalent to the type @f{(simple-array base-char (@param{size}))};
that is, the set of @term{simple} @term{base strings} of size @param{size}.
@node simple-string-p
@syindexanchor{simple-string-p, SYM}
@subsection simple-string-p (Function)
@cindex simple-string-p
@subsubheading Syntax:
@DefunWithValues{simple-string-p, object, generalized-boolean}
@subsubheading Arguments and Values:
@param{object}---an @term{object}.
@param{generalized-boolean}---a @term{generalized boolean}.
@subsubheading Description:
@TypePredicate{object, simple-string}
@subsubheading Examples:
@lisp
(simple-string-p "aaaaaa") @EV{} @term{true}
(simple-string-p (make-array 6
:element-type 'character
:fill-pointer t)) @EV{} @term{false}
@end lisp
@subsubheading Notes:
@lisp
(simple-string-p @param{object}) @EQ{} (typep @param{object} 'simple-string)
@end lisp
@node char; schar
@syindexanchor{char, SYM}
@syindexanchor{schar, SYM}
@subsection char, schar (Accessor)
@cindex char
@cindex schar
@anchor{char}
@anchor{schar}
@subsubheading Syntax:
@DefunWithValues{char, string index, character}
@DefunWithValues{schar, string index, character}
@subsubheading Arguments and Values:
@param{string}---for @symbolref{char, SYM}, a @term{string};
for @symbolref{schar, SYM}, a @term{simple string}.
@param{index}---a @term{valid array index} for the @param{string}.
@param{character}, @param{new-character}---a @term{character}.
@subsubheading Description:
@symbolref{char, SYM} and @symbolref{schar, SYM} @term{access} the @term{element} of @param{string}
specified by @param{index}.
@symbolref{char, SYM} ignores @term{fill pointers} when @term{accessing} @term{elements}.
@subsubheading Examples:
@lisp
(setq my-simple-string (make-string 6 :initial-element #@bsl{}A)) @EV{} "AAAAAA"
(schar my-simple-string 4) @EV{} #@bsl{}A
(setf (schar my-simple-string 4) #@bsl{}B) @EV{} #@bsl{}B
my-simple-string @EV{} "AAAABA"
(setq my-filled-string
(make-array 6 :element-type 'character
:fill-pointer 5
:initial-contents my-simple-string))
@EV{} "AAAAB"
(char my-filled-string 4) @EV{} #@bsl{}B
(char my-filled-string 5) @EV{} #@bsl{}A
(setf (char my-filled-string 3) #@bsl{}C) @EV{} #@bsl{}C
(setf (char my-filled-string 5) #@bsl{}D) @EV{} #@bsl{}D
(setf (fill-pointer my-filled-string) 6) @EV{} 6
my-filled-string @EV{} "AAACBD"
@end lisp
@subsubheading See Also:
@ref{aref},
@ref{elt},
@ref{Compiler Terminology}
@subsubheading Notes:
@lisp
(char s j) @EQ{} (aref (the string s) j)
@end lisp
@node string (Function)
@syindexanchor{string, F}
@subsection string (Function)
@cindex string
@subsubheading Syntax:
@DefunWithValues{string, x, string}
@subsubheading Arguments and Values:
@param{x}---a @term{string}, a @term{symbol}, or a @term{character}.
@param{string}---a @term{string}.
@subsubheading Description:
Returns a @term{string} described by @param{x}; specifically:
@itemize @bullet{}
@item If @param{x} is a @term{string}, it is returned.
@item If @param{x} is a @term{symbol}, its @term{name} is returned.
@item
If @param{x} is a @term{character},
then a @term{string} containing that one @term{character} is returned.
@item
@symbolref{string, F} might perform additional, @term{implementation-defined} conversions.
@end itemize
@subsubheading Examples:
@lisp
(string "already a string") @EV{} "already a string"
(string 'elm) @EV{} "ELM"
(string #@bsl{}c) @EV{} "c"
@end lisp
@subsubheading Exceptional Situations:
In the case where a conversion is defined neither by this specification nor
by the @term{implementation}, an error @oftype{type-error} is signaled.
@subsubheading See Also:
@ref{coerce},
@ref{string (System Class)} (@term{type}).
@subsubheading Notes:
@symbolref{coerce, SYM} can be used to convert a @term{sequence} of @term{characters}
to a @term{string}.
@symbolref{prin1-to-string, SYM}, @symbolref{princ-to-string, SYM}, @symbolref{write-to-string, SYM},
or @symbolref{format, SYM} (with a first argument of @nil{}) can be used to get a
@term{string} representation of a @term{number} or any other @term{object}.
@node string-upcase; string-downcase; string-capitalize; nstring-upcase; nstr+
@syindexanchor{string-upcase, SYM}
@syindexanchor{string-downcase, SYM}
@syindexanchor{string-capitalize, SYM}
@syindexanchor{nstring-upcase, SYM}
@syindexanchor{nstring-downcase, SYM}
@syindexanchor{nstring-capitalize, SYM}
@subsection string-upcase, string-downcase, string-capitalize, nstring-upcase, nstring-downcase, nstring-capitalize (Function)
@cindex string-upcase
@cindex string-downcase
@cindex string-capitalize
@cindex nstring-upcase
@cindex nstring-downcase
@cindex nstring-capitalize
@subsubheading Syntax:
@DefunWithValues{string-upcase, string @keyparam{} start end, cased-string}
@DefunWithValues{string-downcase, string @keyparam{} start end, cased-string}
@DefunWithValues{string-capitalize, string @keyparam{} start end, cased-string}
@DefunWithValues{nstring-upcase, string @keyparam{} start end, string}
@DefunWithValues{nstring-downcase, string @keyparam{} start end, string}
@DefunWithValues{nstring-capitalize, string @keyparam{} start end, string}
@subsubheading Arguments and Values:
@param{string}---a @term{string designator}.
For @symbolref{nstring-upcase, SYM},
@symbolref{nstring-downcase, SYM},
and @symbolref{nstring-capitalize, SYM},
the @param{string} @term{designator} must be a @term{string}.
@param{start}, @param{end}---@term{bounding index designators} of @param{string}.
@Defaults{@param{start} and @param{end}, @f{0} and @nil{}}
@param{cased-string}---a @term{string}.
@subsubheading Description:
@symbolref{string-upcase, SYM}, @symbolref{string-downcase, SYM}, @symbolref{string-capitalize, SYM},
@symbolref{nstring-upcase, SYM}, @symbolref{nstring-downcase, SYM}, @symbolref{nstring-capitalize, SYM}
change the case of the subsequence of @param{string}
@term{bounded} by @param{start} and @param{end}
as follows:
@table @asis
@item @id{@bf{string-upcase}}
@symbolref{string-upcase, SYM} returns a @term{string} just like @param{string}
with all lowercase characters replaced by the corresponding uppercase
characters. More precisely, each character of the result @term{string}
is produced by applying @thefunction{char-upcase} to the corresponding
character of @param{string}.
@item @id{@bf{string-downcase}}
@symbolref{string-downcase, SYM} is like @symbolref{string-upcase, SYM}
except that all uppercase characters are replaced by the corresponding
lowercase characters (using @symbolref{char-downcase, SYM}).
@item @id{@bf{string-capitalize}}
@symbolref{string-capitalize, SYM} produces a copy of @param{string} such that,
for every word in the copy, the first @term{character} of the ``word,''
if it has @term{case}, is @term{uppercase} and
any other @term{characters} with @term{case} in the word are @term{lowercase}.
For the purposes of @symbolref{string-capitalize, SYM},
a ``word'' is defined to be a
consecutive subsequence consisting of @term{alphanumeric} @term{characters},
delimited at each end either by a non-@term{alphanumeric} @term{character}
or by an end of the @term{string}.
@item @id{@bf{nstring-upcase, nstring-downcase, nstring-capitalize }}
@symbolref{nstring-upcase, SYM}, @symbolref{nstring-downcase, SYM},
and @symbolref{nstring-capitalize, SYM} are identical to @symbolref{string-upcase, SYM},
@symbolref{string-downcase, SYM}, and @symbolref{string-capitalize, SYM}
respectively except that they modify @param{string}.
@end table
For @symbolref{string-upcase, SYM}, @symbolref{string-downcase, SYM}, and @symbolref{string-capitalize, SYM},
@param{string} is not modified. However, if no characters in @param{string}
require conversion, the result may be either @param{string} or a copy of it,
at the implementation's discretion.
@subsubheading Examples:
@lisp
(string-upcase "abcde") @EV{} "ABCDE"
(string-upcase "Dr. Livingston, I presume?")
@EV{} "DR. LIVINGSTON, I PRESUME?"
(string-upcase "Dr. Livingston, I presume?" :start 6 :end 10)
@EV{} "Dr. LiVINGston, I presume?"
(string-downcase "Dr. Livingston, I presume?")
@EV{} "dr. livingston, i presume?"
(string-capitalize "elm 13c arthur;fig don't") @EV{} "Elm 13c Arthur;Fig Don'T"
(string-capitalize " hello ") @EV{} " Hello "
(string-capitalize "occlUDeD cASEmenTs FOreSTAll iNADVertent DEFenestraTION")
@EV{} "Occluded Casements Forestall Inadvertent Defenestration"
(string-capitalize 'kludgy-hash-search) @EV{} "Kludgy-Hash-Search"
(string-capitalize "DON'T!") @EV{} "Don'T!" ;not "Don't!"
(string-capitalize "pipe 13a, foo16c") @EV{} "Pipe 13a, Foo16c"
(setq str (copy-seq "0123ABCD890a")) @EV{} "0123ABCD890a"
(nstring-downcase str :start 5 :end 7) @EV{} "0123AbcD890a"
str @EV{} "0123AbcD890a"
@end lisp
@subsubheading Side Effects:
@symbolref{nstring-upcase, SYM},
@symbolref{nstring-downcase, SYM},
and @symbolref{nstring-capitalize, SYM} modify @param{string} as appropriate
rather than constructing a new @term{string}.
@subsubheading See Also:
@ref{char-upcase}, @ref{char-downcase}
@subsubheading Notes:
The result is always of the same length
as @param{string}.
@node string-trim; string-left-trim; string-right-trim
@syindexanchor{string-trim, SYM}
@syindexanchor{string-left-trim, SYM}
@syindexanchor{string-right-trim, SYM}
@subsection string-trim, string-left-trim, string-right-trim (Function)
@cindex string-trim
@cindex string-left-trim
@cindex string-right-trim
@subsubheading Syntax:
@DefunWithValues{string-trim, character-bag string, trimmed-string}
@DefunWithValues{string-left-trim, character-bag string, trimmed-string}
@DefunWithValues{string-right-trim, character-bag string, trimmed-string}
@subsubheading Arguments and Values:
@param{character-bag}---a @term{sequence} containing @term{characters}.
@param{string}---a @term{string designator}.
@param{trimmed-string}---a @term{string}.
@subsubheading Description:
@symbolref{string-trim, SYM} returns a substring of @param{string},
with all characters in @param{character-bag} stripped off the beginning and end.
@symbolref{string-left-trim, SYM} is similar but strips characters off only the beginning;
@symbolref{string-right-trim, SYM} strips off only the end.
If no @term{characters} need to be trimmed from the @param{string},
then either @param{string} itself or a copy of it may be returned,
at the discretion of the implementation.
All of these @term{functions} observe the @term{fill pointer}.
@subsubheading Examples:
@lisp
(string-trim "abc" "abcaakaaakabcaaa") @EV{} "kaaak"
(string-trim '(#@bsl{}Space #@bsl{}Tab #@bsl{}Newline) " garbanzo beans
") @EV{} "garbanzo beans"
(string-trim " (*)" " ( *three (silly) words* ) ")
@EV{} "three (silly) words"
(string-left-trim "abc" "labcabcabc") @EV{} "labcabcabc"
(string-left-trim " (*)" " ( *three (silly) words* ) ")
@EV{} "three (silly) words* ) "
(string-right-trim " (*)" " ( *three (silly) words* ) ")
@EV{} " ( *three (silly) words"
@end lisp
@subsubheading Affected By:
The @term{implementation}.
@node string=; string/=; string<; string>; string<=; string>=; string-equal; +
@syindexanchor{string=, SYM}
@syindexanchor{string/=, SYM}
@syindexanchor{string<, SYM}
@syindexanchor{string>, SYM}
@syindexanchor{string<=, SYM}
@syindexanchor{string>=, SYM}
@syindexanchor{string-equal, SYM}
@syindexanchor{string-not-equal, SYM}
@syindexanchor{string-lessp, SYM}
@syindexanchor{string-greaterp, SYM}
@syindexanchor{string-not-greaterp, SYM}
@syindexanchor{string-not-lessp, SYM}
@subsection string=, string/=, string<, string>, string<=, string>=, string-equal, string-not-equal, string-lessp, string-greaterp, string-not-greaterp, string-not-lessp (Function)
@cindex string=
@cindex string/=
@cindex string<
@cindex string>
@cindex string<=
@cindex string>=
@cindex string-equal
@cindex string-not-equal
@cindex string-lessp
@cindex string-greaterp
@cindex string-not-greaterp
@cindex string-not-lessp
@anchor{string=}
@anchor{string-equal}
@subsubheading Syntax:
@DefunWithValues{string@mat{=}, string1 string2 @keyparam{} start1 end1 start2 end2, generalized-boolean}
@DefunWithValues{string/@mat{=}, string1 string2 @keyparam{} start1 end1 start2 end2, mismatch-index}
@DefunWithValues{string@mat{<}, string1 string2 @keyparam{} start1 end1 start2 end2, mismatch-index}
@DefunWithValues{string@mat{>}, string1 string2 @keyparam{} start1 end1 start2 end2, mismatch-index}
@DefunWithValues{string@mat{<=}, string1 string2 @keyparam{} start1 end1 start2 end2, mismatch-index}
@DefunWithValues{string@mat{>=}, string1 string2 @keyparam{} start1 end1 start2 end2, mismatch-index}
@DefunWithValues{string-equal, string1 string2 @keyparam{} start1 end1 start2 end2, generalized-boolean}
@DefunWithValues{string-not-equal, string1 string2 @keyparam{} start1 end1 start2 end2, mismatch-index}
@DefunWithValues{string-lessp, string1 string2 @keyparam{} start1 end1 start2 end2, mismatch-index}
@DefunWithValues{string-greaterp, string1 string2 @keyparam{} start1 end1 start2 end2, mismatch-index}
@DefunWithValues{string-not-greaterp, string1 string2 @keyparam{} start1 end1 start2 end2, mismatch-index}
@DefunWithValues{string-not-lessp, string1 string2 @keyparam{} start1 end1 start2 end2, mismatch-index}
@subsubheading Arguments and Values:
@param{string1}---a @term{string designator}.
@param{string2}---a @term{string designator}.
@param{start1}, @param{end1}---@term{bounding index designators} of @param{string1}.
@Defaults{@param{start} and @param{end}, @f{0} and @nil{}}
@param{start2}, @param{end2}---@term{bounding index designators} of @param{string2}.
@Defaults{@param{start} and @param{end}, @f{0} and @nil{}}
@param{generalized-boolean}---a @term{generalized boolean}.
@param{mismatch-index}---a @term{bounding index} of @param{string1}, or @nil{}.
@subsubheading Description:
These functions perform lexicographic comparisons on @param{string1} and @param{string2}.
@symbolref{string=, SYM} and @symbolref{string-equal, SYM} are called equality functions;
the others are called inequality functions.
The comparison operations these @term{functions} perform are restricted
to the subsequence of @param{string1} @term{bounded} by @param{start1} and @param{end1}
and to the subsequence of @param{string2} @term{bounded} by @param{start2} and @param{end2}.
A string @i{a} is equal to a string @i{b} if it contains the same number
of characters, and the corresponding characters are the @term{same}
under @symbolref{char=, SYM} or @symbolref{char-equal, SYM}, as appropriate.
A string @i{a} is less than a string @i{b} if in the first position in
which they differ the character of @i{a} is less than the corresponding
character of @i{b} according to @symbolref{char<, SYM} or @symbolref{char-lessp, SYM}
as appropriate, or if string @i{a} is a proper prefix of string @i{b}
(of shorter length and matching in all the characters of @i{a}).
The equality functions return a @param{generalized boolean}
that is @term{true} if the strings are equal,
or @term{false} otherwise.
The inequality functions return a @param{mismatch-index}
that is @term{true} if the strings are not equal,
or @term{false} otherwise.
When the @param{mismatch-index} is @term{true},
it is an @term{integer} representing the first character position at which the
two substrings differ, as an offset from the beginning of @param{string1}.
The comparison has one of the following results:
@table @asis
@item @id{@symbolref{string=, SYM}}
@symbolref{string=, SYM} is @term{true} if the supplied substrings are of
the same length and contain the @term{same} characters in corresponding
positions; otherwise it is @term{false}.
@item @id{@symbolref{string/=, SYM}}
@symbolref{string/=, SYM} is @term{true} if the supplied substrings are
different; otherwise it is @term{false}.
@item @id{@symbolref{string-equal, SYM}}
@symbolref{string-equal, SYM} is just like @symbolref{string=, SYM}
except that differences in case are ignored;
two characters are considered to be the same if @symbolref{char-equal, SYM} is @term{true} of them.
@item @id{@symbolref{string<, SYM}}
@symbolref{string<, SYM} is @term{true} if substring1 is less than substring2;
otherwise it is @term{false}.
@item @id{@symbolref{string>, SYM}}
@symbolref{string>, SYM} is @term{true} if substring1 is greater than substring2;
otherwise it is @term{false}.
@item @id{@symbolref{string-lessp, SYM}, @symbolref{string-greaterp, SYM}}
@symbolref{string-lessp, SYM} and @symbolref{string-greaterp, SYM}
are exactly like @symbolref{string<, SYM} and @symbolref{string>, SYM}, respectively,
except that distinctions between uppercase and lowercase letters are ignored.
It is as if @symbolref{char-lessp, SYM} were used instead of @symbolref{char<, SYM}
for comparing characters.
@item @id{@symbolref{string<=, SYM}}
@symbolref{string<=, SYM} is @term{true} if substring1 is less than or equal to substring2;
otherwise it is @term{false}.
@item @id{@symbolref{string>=, SYM}}
@symbolref{string>=, SYM} is @term{true} if substring1 is greater than or equal to substring2;
otherwise it is @term{false}.
@item @id{@symbolref{string-not-greaterp, SYM}, @symbolref{string-not-lessp, SYM}}
@symbolref{string-not-greaterp, SYM} and @symbolref{string-not-lessp, SYM}
are exactly like @symbolref{string<=, SYM} and @symbolref{string>=, SYM}, respectively,
except that distinctions between uppercase and lowercase letters are ignored.
It is as if @symbolref{char-lessp, SYM} were used instead of @symbolref{char<, SYM}
for comparing characters.
@end table
@subsubheading Examples:
@lisp
(string= "foo" "foo") @EV{} @term{true}
(string= "foo" "Foo") @EV{} @term{false}
(string= "foo" "bar") @EV{} @term{false}
(string= "together" "frog" :start1 1 :end1 3 :start2 2) @EV{} @term{true}
(string-equal "foo" "Foo") @EV{} @term{true}
(string= "abcd" "01234abcd9012" :start2 5 :end2 9) @EV{} @term{true}
(string< "aaaa" "aaab") @EV{} 3
(string>= "aaaaa" "aaaa") @EV{} 4
(string-not-greaterp "Abcde" "abcdE") @EV{} 5
(string-lessp "012AAAA789" "01aaab6" :start1 3 :end1 7
:start2 2 :end2 6) @EV{} 6
(string-not-equal "AAAA" "aaaA") @EV{} @term{false}
@end lisp
@subsubheading See Also:
@ref{char=}
@subsubheading Notes:
@symbolref{equal, SYM} calls @symbolref{string=, SYM} if applied to two @term{strings}.
@node stringp
@syindexanchor{stringp, SYM}
@subsection stringp (Function)
@cindex stringp
@subsubheading Syntax:
@DefunWithValues{stringp, object, generalized-boolean}
@subsubheading Arguments and Values:
@param{object}---an @term{object}.
@param{generalized-boolean}---a @term{generalized boolean}.
@subsubheading Description:
@TypePredicate{object, string}
@subsubheading Examples:
@lisp
(stringp "aaaaaa") @EV{} @term{true}
(stringp #@bsl{}a) @EV{} @term{false}
@end lisp
@subsubheading See Also:
@ref{typep},
@ref{string (System Class)} (@term{type})
@subsubheading Notes:
@lisp
(stringp @param{object}) @EQ{} (typep @param{object} 'string)
@end lisp
@node make-string
@syindexanchor{make-string, SYM}
@subsection make-string (Function)
@cindex make-string
@subsubheading Syntax:
@DefunWithValues{make-string, size @keyparam{} initial-element element-type, string}
@subsubheading Arguments and Values:
@param{size}---a @term{valid array dimension}.
@param{initial-element}---a @term{character}.
@Default{@term{implementation-dependent}}
@param{element-type}---a @term{type specifier}.
@Default{@symbolref{character, SC}}
@param{string}---a @term{simple string}.
@subsubheading Description:
@symbolref{make-string, SYM} returns a @term{simple string} of length @param{size}
whose elements have been initialized to @param{initial-element}.
The @param{element-type} names the @term{type} of the @term{elements} of the @term{string};
a @term{string} is constructed of the most @term{specialized}
@term{type} that can accommodate @term{elements} of the given @term{type}.
@subsubheading Examples:
@lisp
(make-string 10 :initial-element #@bsl{}5) @EV{} "5555555555"
(length (make-string 10)) @EV{} 10
@end lisp
@subsubheading Affected By:
The @term{implementation}.