-
Notifications
You must be signed in to change notification settings - Fork 2
/
uSTRROUTES.pas
22680 lines (21382 loc) · 625 KB
/
uSTRROUTES.pas
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
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
unit uSTRROUTES;
interface
{ Ìíîæåñòâî ñèìâîëîâ â ÿçûêå Ïàñêàëü. }
type
TCharSet = set of Char;
{ Ñèìâîëû, ïî óìîë÷àíèþ èñïîëüçóåìûå êàê ðàçäåëèòåëè ñëîâ. }
const
Q_StdDelimsSet3 = [#0..#32, '!', '"', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '[', '\', ']', '^', '{', '}', '|'];
Q_SP = [#0..#32];
Q_BLD = Q_SP + ['(', ')', ','];
Q_Hex = ['A'..'F', 'a'..'f', '0'..'9'];
Q_RNA = Q_Hex + ['G'..'Z', 'g'..'z', '_'];
Q_ValidString = Q_RNA + ['À'..'ß', 'à'..'ÿ'];
Q_Mth = ['+', '-', '=', '*', '/', '>', '<'];
Q_Datas = ['@', '$', '&', '#', '''', '"'];
Q_Math = Q_SP + Q_Mth;
Q_M = Q_BLD + Q_Math + ['[', ']', 's', 'S', 'v', 'V', ':'];
{ Íàçâàíèÿ ìåñÿöåâ è äíåé íåäåëè. }
Q_MonthsUp: array[1..12] of string =
('ßíâàðü', 'Ôåâðàëü', 'Ìàðò', 'Àïðåëü', 'Ìàé', 'Èþíü', 'Èþëü', 'Àâãóñò',
'Ñåíòÿáðü', 'Îêòÿáðü', 'Íîÿáðü', 'Äåêàáðü');
Q_MonthsLo: array[1..12] of string =
('ÿíâàðÿ', 'ôåâðàëÿ', 'ìàðòà', 'àïðåëÿ', 'ìàÿ', 'èþíÿ', 'èþëÿ', 'àâãóñòà',
'ñåíòÿáðÿ', 'îêòÿáðÿ', 'íîÿáðÿ', 'äåêàáðÿ');
Q_MonthsEng: array[1..12] of string =
('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August',
'September', 'October', 'November', 'December');
Q_SMonthsUp: array[1..12] of string =
('ßíâ', 'Ôåâ', 'Ìàð', 'Àïð', 'Ìàé', 'Èþí', 'Èþë', 'Àâã', 'Ñåí', 'Îêò', 'Íîÿ', 'Äåê');
Q_SMonthsLo: array[1..12] of string =
('ÿíâ', 'ôåâ', 'ìàð', 'àïð', 'ìàÿ', 'èþí', 'èþë', 'àâã', 'ñåí', 'îêò', 'íîÿ', 'äåê');
Q_SMonthsEng: array[1..12] of string =
('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
Q_WeekDays: array[1..7] of string =
('Âîñêðåñåíüå', 'Ïîíåäåëüíèê', 'Âòîðíèê', 'Ñðåäà', '×åòâåðã',
'Ïÿòíèöà', 'Ñóááîòà');
Q_WeekDaysEng: array[1..7] of string =
('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
Q_SWeekDays2: array[1..7] of string =
('Âñ', 'Ïí', 'Âò', 'Ñð', '×ò', 'Ïò', 'Ñá');
Q_SWeekDays3: array[1..7] of string =
('Âñê', 'Ïîí', 'Âòð', 'Ñðä', '×åò', 'Ïÿò', 'Ñóá');
Q_SWeekDaysEng: array[1..7] of string =
('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
CRC32_Table: array[0..255] of LongWord =
($00000000, $77073096, $EE0E612C, $990951BA, $076DC419, $706AF48F, $E963A535, $9E6495A3,
$0EDB8832, $79DCB8A4, $E0D5E91E, $97D2D988, $09B64C2B, $7EB17CBD, $E7B82D07, $90BF1D91,
$1DB71064, $6AB020F2, $F3B97148, $84BE41DE, $1ADAD47D, $6DDDE4EB, $F4D4B551, $83D385C7,
$136C9856, $646BA8C0, $FD62F97A, $8A65C9EC, $14015C4F, $63066CD9, $FA0F3D63, $8D080DF5,
$3B6E20C8, $4C69105E, $D56041E4, $A2677172, $3C03E4D1, $4B04D447, $D20D85FD, $A50AB56B,
$35B5A8FA, $42B2986C, $DBBBC9D6, $ACBCF940, $32D86CE3, $45DF5C75, $DCD60DCF, $ABD13D59,
$26D930AC, $51DE003A, $C8D75180, $BFD06116, $21B4F4B5, $56B3C423, $CFBA9599, $B8BDA50F,
$2802B89E, $5F058808, $C60CD9B2, $B10BE924, $2F6F7C87, $58684C11, $C1611DAB, $B6662D3D,
$76DC4190, $01DB7106, $98D220BC, $EFD5102A, $71B18589, $06B6B51F, $9FBFE4A5, $E8B8D433,
$7807C9A2, $0F00F934, $9609A88E, $E10E9818, $7F6A0DBB, $086D3D2D, $91646C97, $E6635C01,
$6B6B51F4, $1C6C6162, $856530D8, $F262004E, $6C0695ED, $1B01A57B, $8208F4C1, $F50FC457,
$65B0D9C6, $12B7E950, $8BBEB8EA, $FCB9887C, $62DD1DDF, $15DA2D49, $8CD37CF3, $FBD44C65,
$4DB26158, $3AB551CE, $A3BC0074, $D4BB30E2, $4ADFA541, $3DD895D7, $A4D1C46D, $D3D6F4FB,
$4369E96A, $346ED9FC, $AD678846, $DA60B8D0, $44042D73, $33031DE5, $AA0A4C5F, $DD0D7CC9,
$5005713C, $270241AA, $BE0B1010, $C90C2086, $5768B525, $206F85B3, $B966D409, $CE61E49F,
$5EDEF90E, $29D9C998, $B0D09822, $C7D7A8B4, $59B33D17, $2EB40D81, $B7BD5C3B, $C0BA6CAD,
$EDB88320, $9ABFB3B6, $03B6E20C, $74B1D29A, $EAD54739, $9DD277AF, $04DB2615, $73DC1683,
$E3630B12, $94643B84, $0D6D6A3E, $7A6A5AA8, $E40ECF0B, $9309FF9D, $0A00AE27, $7D079EB1,
$F00F9344, $8708A3D2, $1E01F268, $6906C2FE, $F762575D, $806567CB, $196C3671, $6E6B06E7,
$FED41B76, $89D32BE0, $10DA7A5A, $67DD4ACC, $F9B9DF6F, $8EBEEFF9, $17B7BE43, $60B08ED5,
$D6D6A3E8, $A1D1937E, $38D8C2C4, $4FDFF252, $D1BB67F1, $A6BC5767, $3FB506DD, $48B2364B,
$D80D2BDA, $AF0A1B4C, $36034AF6, $41047A60, $DF60EFC3, $A867DF55, $316E8EEF, $4669BE79,
$CB61B38C, $BC66831A, $256FD2A0, $5268E236, $CC0C7795, $BB0B4703, $220216B9, $5505262F,
$C5BA3BBE, $B2BD0B28, $2BB45A92, $5CB36A04, $C2D7FFA7, $B5D0CF31, $2CD99E8B, $5BDEAE1D,
$9B64C2B0, $EC63F226, $756AA39C, $026D930A, $9C0906A9, $EB0E363F, $72076785, $05005713,
$95BF4A82, $E2B87A14, $7BB12BAE, $0CB61B38, $92D28E9B, $E5D5BE0D, $7CDCEFB7, $0BDBDF21,
$86D3D2D4, $F1D4E242, $68DDB3F8, $1FDA836E, $81BE16CD, $F6B9265B, $6FB077E1, $18B74777,
$88085AE6, $FF0F6A70, $66063BCA, $11010B5C, $8F659EFF, $F862AE69, $616BFFD3, $166CCF45,
$A00AE278, $D70DD2EE, $4E048354, $3903B3C2, $A7672661, $D06016F7, $4969474D, $3E6E77DB,
$AED16A4A, $D9D65ADC, $40DF0B66, $37D83BF0, $A9BCAE53, $DEBB9EC5, $47B2CF7F, $30B5FFE9,
$BDBDF21C, $CABAC28A, $53B39330, $24B4A3A6, $BAD03605, $CDD70693, $54DE5729, $23D967BF,
$B3667A2E, $C4614AB8, $5D681B02, $2A6F2B94, $B40BBE37, $C30C8EA1, $5A05DF1B, $2D02EF8D);
{ Ôóíêöèè äëÿ ñðàâíåíèÿ ñòðîê. }
{ Q_CompStr ñðàâíèâàåò äâå ñòðîêè ñ ó÷åòîì ðåãèñòðà. Âîçâðàùàåìûé ðåçóëüòàò
ìåíüøå íóëÿ, åñëè S1 < S2; áîëüøå íóëÿ, åñëè S1 > S2, è ðàâåí íóëþ, åñëè
S1 = S2. Ýòà ôóíêöèÿ ïðåêðàùàåò ñðàâíåíèå, êîãäà îáíàðóæåíî ðàçëè÷èå ñòðîê
èëè êîãäà îáíàðóæåí ñèìâîë ñ êîäîì 0. Åñëè ýòîò ñèìâîë ìîæåò âñòðå÷àòüñÿ â
ñåðåäèíå ñòðîêè, èñïîëüçóéòå âìåñòî Q_CompStr ôóíêöèþ Q_CompStrL. Âòîðàÿ
ôóíêöèÿ Q_PCompStr àíàëîãè÷íà Q_CompStr äëÿ PChar è Pointer(String). Åñëè
íåîáõîäèìî âûÿñíèòü òîëüêî, ðàâíû äâå ñòðîêè èëè íå ðàâíû, âîñïîëüçóéòåñü
âìåñòî Q_CompStr ôóíêöèåé Q_SameStr. }
function Q_CompStr(const S1, S2: string): Integer;
function Q_PCompStr(P1, P2: PChar): Integer;
{ Q_CompStrL ñðàâíèâàåò äâå ñòðîêè ïî MaxL ïåðâûì ñèìâîëàì ñ ó÷åòîì ðåãèñòðà.
Âîçâðàùàåìûé ðåçóëüòàò ìåíüøå íóëÿ, åñëè Copy(S1,1,MaxL) < Copy(S2,1,MaxL);
ðåçóëüòàò áîëüøå íóëÿ, åñëè Copy(S1,1,MaxL) > Copy(S2,1,MaxL), èíà÷å
ðåçóëüòàò ðàâåí íóëþ (åñëè Copy(S1,1,MaxL) = Copy(S2,1,MaxL) ). Åñëè Âàì
íàäî âûÿñíèòü òîëüêî, ðàâíû äâå ñòðîêè èëè íå ðàâíû, âîñïîëüçóéòåñü
âìåñòî Q_CompStrL ôóíêöèåé Q_SameStrL. }
function Q_CompStrL(const S1, S2: string; MaxL: Cardinal = MaxInt): Integer;
{ Q_CompText ñðàâíèâàåò äâå ñòðîêè áåç ó÷åòà ðåãèñòðà. Âîçâðàùàåìûé ðåçóëüòàò
ìåíüøå íóëÿ, åñëè S1 < S2; áîëüøå íóëÿ, åñëè S1 > S2, è ðàâåí íóëþ, åñëè
S1 = S2. Ýòà ôóíêöèÿ ïðåêðàùàåò ñðàâíåíèå, êîãäà îáíàðóæåíî ðàçëè÷èå ñòðîê
èëè êîãäà îáíàðóæåí ñèìâîë ñ êîäîì 0. Åñëè ýòîò ñèìâîë ìîæåò âñòðå÷àòüñÿ â
ñåðåäèíå ñòðîêè, èñïîëüçóéòå âìåñòî Q_CompText ôóíêöèþ Q_CompTextL. Âòîðàÿ
ôóíêöèÿ Q_PCompText àíàëîãè÷íà Q_CompText äëÿ PChar è Pointer(String). Åñëè
íåîáõîäèìî âûÿñíèòü òîëüêî, ðàâíû ëè äâå ñòðîêè èëè íåò, âîñïîëüçóéòåñü
âìåñòî Q_CompText ôóíêöèåé Q_SameText. }
function Q_CompText(const S1, S2: string): Integer;
function Q_PCompText(P1, P2: PChar): Integer;
{ Q_CompTextL ñðàâíèâàåò äâå ñòðîêè ïî MaxL ïåðâûì ñèìâîëàì áåç ó÷åòà ðåãèñòðà.
Åñëè ôðàãìåíò ïåðâîé ñòðîêè áîëüøå (â àëôàâèòíîì ïîðÿäêå), ÷åì ôðàãìåíò
âòîðîé ñòðîêè, âîçâðàùàåìîå çíà÷åíèå áîëüøå íóëÿ. Åñëè ôðàãìåíò ïåðâîé ñòðîêè
ìåíüøå, ÷åì ôðàãìåíò âòîðîé ñòðîêè, âîçâðàùàåìîå çíà÷åíèå ìåíüøå íóëÿ, èíà÷å
ðåçóëüòàò ðàâåí íóëþ. Åñëè íåîáõîäèìî âûÿñíèòü òîëüêî, ðàâíû ëè äâå ñòðîêè
èëè íå ðàâíû, èñïîëüçóéòå âìåñòî Q_CompTextL ôóíêöèþ Q_SameTextL. }
function Q_CompTextL(const S1, S2: string; MaxL: Cardinal = MaxInt): Integer;
{ Q_SameStr ñðàâíèâàåò äâå ñòðîêè ñ ó÷åòîì ðåãèñòðà è âîçâðàùàåò True, åñëè
ñòðîêè ðàâíû, èíà÷å âîçâðàùàåò False. Ôóíêöèÿ Q_PSameStr àíàëîãè÷íà Q_SameStr
äëÿ Pointer(String). }
function Q_SameStr(const S1, S2: string): Boolean;
function Q_PSameStr(P1, P2: Pointer): Boolean;
{ Q_SameStrL ñðàâíèâàåò äâå ñòðîêè ïî MaxL ïåðâûì ñèìâîëàì ñ ó÷åòîì ðåãèñòðà.
Âîçâðàùàåò True, åñëè ñòðîêè ðàâíû, èíà÷å âîçâðàùàåò False. }
function Q_SameStrL(const S1, S2: string; MaxL: Cardinal): Boolean;
{ Q_SameText ñðàâíèâàåò äâå ñòðîêè áåç ó÷åòà ðåãèñòðà è âîçâðàùàåò True, åñëè
ñòðîêè ðàâíû, èíà÷å - False. Ôóíêöèÿ Q_PSameText àíàëîãè÷íà Q_SameStr äëÿ
Pointer(String). }
function Q_SameText(const S1, S2: string): Boolean;
function Q_PSameText(P1, P2: Pointer): Boolean;
{ Q_SameTextL ñðàâíèâàåò äâå ñòðîêè ïî MaxL ïåðâûì ñèìâîëàì áåç ó÷åòà ðåãèñòðà.
Âîçâðàùàåò True, åñëè ñòðîêè ðàâíû, èíà÷å âîçâðàùàåò False. }
function Q_SameTextL(const S1, S2: string; MaxL: Cardinal): Boolean;
{ Q_MatchStr ïðîâåðÿåò, èìååò ëè ìåñòî âõîæäåíèå ïîäñòðîêè SubStr â ñòðîêó S,
íà÷èíàÿ ñ ñèìâîëà S[Pos]. Ïðè ñðàâíåíèè ó÷èòûâàåòñÿ ðåãèñòð ñèìâîëîâ. Åñëè
âõîæäåíèå èìååò ìåñòî, ôóíêöèÿ âîçâðàùàåò True, èíà÷å - False. Ýòà ôóíêöèÿ
ðåàëèçóåò ñîáîé áûñòðûé âàðèàíò ïðîâåðêè Q_SameStr(X,Copy(S,Pos,Length(X))).
 îòëè÷èå îò äðóãèõ àíàëîãè÷íûõ ôóíêöèé, ïîäñòðîêà íóëåâîé äëèíû âõîäèò â
ëþáóþ ñòðîêó. Èäåÿ ýòîé ôóíêöèè çàèìñòâîâàíà èç ìîäóëÿ cStrings.pas, àâòîðîì
êîòîðîãî ÿâëÿåòñÿ David Butler ([email protected]). }
function Q_MatchStr(const SubStr, S: string; Pos: Integer = 1): Boolean;
{ Q_MatchText ïðîâåðÿåò, èìååò ëè ìåñòî âõîæäåíèå ïîäñòðîêè SubStr â ñòðîêó S,
íà÷èíàÿ ñ ñèìâîëà S[Pos]. Ïðè ñðàâíåíèè ðåãèñòð ñèìâîëîâ íå ó÷èòûâàåòñÿ. Åñëè
âõîæäåíèå èìååò ìåñòî, ôóíêöèÿ âîçâðàùàåò True, èíà÷å - False. Ýòà ôóíêöèÿ
ðåàëèçóåò ñîáîé áûñòðûé âàðèàíò ïðîâåðêè Q_SameText(X,Copy(S,Pos,Length(X))).
 îòëè÷èå îò äðóãèõ àíàëîãè÷íûõ ôóíêöèé, ïîäñòðîêà íóëåâîé äëèíû âõîäèò â
ëþáóþ ñòðîêó. Èäåÿ ýòîé ôóíêöèè çàèìñòâîâàíà èç ìîäóëÿ cStrings.pas, àâòîðîì
êîòîðîãî ÿâëÿåòñÿ David Butler ([email protected]). }
function Q_MatchText(const SubStr, S: string; Pos: Integer = 1): Boolean;
{ Q_TestByMask ïðîâåðÿåò, óäîâëåòâîðÿåò ëè ñòðîêà S ìàñêå Mask, ïðåäïîëàãàÿ,
÷òî ñèìâîëû MaskChar èç ñòðîêè Mask ìîãóò áûòü çàìåíåíû â ñòðîêå S ëþáûìè
äðóãèìè ñèìâîëàìè. Ïðè ñðàâíåíèè ðåãèñòð ñèìâîëîâ ïðèíèìàåòñÿ âî âíèìàíèå.
Åñëè ñòðîêà S óäîâëåòâîðÿåò ìàñêå, ôóíêöèÿ âîçâðàùàåò True, èíà÷å False.
Íàïðèìåð, Q_TestMask('ISBN 5-09-007017-2','ISBN ?-??-??????-?','?') âåðíåò
çíà÷åíèå True. }
function Q_TestByMask(const S, Mask: string; MaskChar: Char = 'X'): Boolean;
{ Q_TestWildStr ïðîâåðÿåò, óäîâëåòâîðÿåò ëè ñòðîêà S ìàñêå Mask, ïðåäïîëàãàÿ,
÷òî ñèìâîëû MaskChar èç ñòðîêè Mask ìîãóò áûòü çàìåíåíû â ñòðîêå S ëþáûìè
äðóãèìè ñèìâîëàìè, à ñèìâîëû WildCard ìîãóò áûòü çàìåíåíû ëþáûì êîëè÷åñòâîì
äðóãèõ ñèìâîëîâ. Ïðè ñðàâíåíèè áîëüøèå è ìàëåíüêèå áóêâû ðàçëè÷àþòñÿ. Ñèìâîë
WildCard äîëæåí áûòü îòëè÷åí îò #0. Åñëè ñòðîêà S óäîâëåòâîðÿåò ìàñêå,
ôóíêöèÿ âîçâðàùàåò True, èíà÷å False. Íàïðèìåð, ñëåäóþùèé âûçîâ ôóíêöèè
âåðíåò True: Q_TestWildStr('abc12345_infQ_XL.dat','abc*_???Q_*.d*at'). }
function Q_TestWildStr(const S, Mask: string; MaskChar: Char = '?';
WildCard: Char = '*'): Boolean;
{ Q_TestWildText àíàëîãè÷íà ôóíêöèè Q_TestWildStr, íî ðåãèñòð ñèìâîëîâ
íå ïðèíèìàåòñÿ âî âíèìàíèå (áîëüøèå è ìàëåíüêèå áóêâû íå ðàçëè÷àþòñÿ). }
function Q_TestWildText(const S, Mask: string; MaskChar: Char = '?';
WildCard: Char = '*'): Boolean;
{ Ôóíêöèè äëÿ èçìåíåíèÿ ðåãèñòðà ñèìâîëîâ. }
{ Q_CharUpper ïåðåâîäèò ñèìâîë Ch â âåðõíèé ðåãèñòð (â áîëüøóþ áóêâó). }
function Q_CharUpper(Ch: Char): Char;
{ Q_CharLower ïåðåâîäèò ñèìâîë Ch â íèæíèé ðåãèñòð (â ìàëåíüêóþ áóêâó). }
function Q_CharLower(Ch: Char): Char;
{ Q_StrUpper ïåðåâîäèò ñòðîêó S â âåðõíèé ðåãèñòð (â áîëüøèå áóêâû). Ïðè
ýòîì èçìåíÿåòñÿ èñõîäíàÿ ñòðîêà. Ôóíêöèÿ Q_PStrUpper àíàëîãè÷íà ïðîöåäóðå
Q_StrUpper äëÿ PChar è Pointer(String), çà èñêëþ÷åíèåì òîãî, ÷òî îíà
äîïîëíèòåëüíî âîçâðàùàåò óêàçàòåëü íà íà÷àëî ñòðîêè. }
procedure Q_StrUpper(var S: string);
function Q_PStrUpper(P: PChar): PChar;
{ Q_StrLower ïåðåâîäèò ñòðîêó S â íèæíèé ðåãèñòð (â ìàëåíüêèå áóêâû). Ïðè
ýòîì èçìåíÿåòñÿ èñõîäíàÿ ñòðîêà. Ôóíêöèÿ Q_PStrLower àíàëîãè÷íà ïðîöåäóðå
Q_StrLower äëÿ PChar è Pointer(String), çà èñêëþ÷åíèåì òîãî, ÷òî îíà
äîïîëíèòåëüíî âîçâðàùàåò óêàçàòåëü íà íà÷àëî ñòðîêè. }
procedure Q_StrLower(var S: string);
function Q_PStrLower(P: PChar): PChar;
{ Q_StrUpperMoveL êîïèðóåò ñîäåðæèìîå ñòðîêè Source â ñòðîêó Dest. Ïðè ýòîì
ñèìâîëû ïåðåâîäÿòñÿ â âåðõíèé ðåãèñòð. Ìàêñèìàëüíîå ÷èñëî êîïèðóåìûõ
ñèìâîëîâ ðàâíî MaxL. Äëèíà ñòðîêè Dest óñòàíàâëèâàåòñÿ ðàâíîé ÷èñëó
ñêîïèðîâàííûõ ñèìâîëîâ. Ïàìÿòü äëÿ ñòðîêè Dest äîëæíà áûòü ðàñïðåäåëåíà
çàáëàãîâðåìåííî âûçîâîì ôóíêöèè SetString (èëè SetLength) (ðàçìåðîì
íå ìåíåå MaxL ñèìâîëîâ). }
procedure Q_StrUpperMoveL(const Source: string; var Dest: string; MaxL: Cardinal);
{ Q_StrLowerMoveL êîïèðóåò ñîäåðæèìîå ñòðîêè Source â ñòðîêó Dest. Ïðè ýòîì
ñèìâîëû ïåðåâîäÿòñÿ â íèæíèé ðåãèñòð. Ìàêñèìàëüíîå ÷èñëî êîïèðóåìûõ
ñèìâîëîâ ðàâíî MaxL. Äëèíà ñòðîêè Dest óñòàíàâëèâàåòñÿ ðàâíîé ÷èñëó
ñêîïèðîâàííûõ ñèìâîëîâ. Ïàìÿòü äëÿ ñòðîêè Dest äîëæíà áûòü ðàñïðåäåëåíà
ïðåäâàðèòåëüíî âûçîâîì ôóíêöèè SetString (èëè SetLength) (ðàçìåðîì
íå ìåíåå MaxL ñèìâîëîâ). }
procedure Q_StrLowerMoveL(const Source: string; var Dest: string; MaxL: Cardinal);
{ Q_UpperCase ïåðåâîäèò ñòðîêó S â âåðõíèé ðåãèñòð (â áîëüøèå áóêâû). Èñõîäíàÿ
ñòðîêà ïðè ýòîì íå èçìåíÿåòñÿ. Ýòà ôóíêöèÿ ðàáîòàåò ìåäëåííåå, ÷åì Q_StrUpper
èëè Q_StrUpperMoveL. }
function Q_UpperCase(const S: string): string;
{ Q_LowerCase ïåðåâîäèò ñòðîêó S â íèæíèé ðåãèñòð (â ìàëåíüêèå áóêâû). Èñõîäíàÿ
ñòðîêà ïðè ýòîì íå èçìåíÿåòñÿ. Ýòà ôóíêöèÿ ðàáîòàåò ìåäëåííåå, ÷åì Q_StrLower
èëè Q_StrLowerMoveL. }
function Q_LowerCase(const S: string): string;
{ Q_UpLowerInPlace ïðåîáðàçóåò ïåðâûé ñèìâîë ñòðîêè ê âåðõíåìó ðåãèñòðó, à âñå
îñòàëüíûå ñèìâîëû - ê íèæíåìó ðåãèñòðó. Èñõîäíàÿ ñòðîêà èçìåíÿåòñÿ. }
procedure Q_UpLowerInPlace(var S: string);
{ Q_UpLowerStr ïðåîáðàçóåò ïåðâûé ñèìâîë ñòðîêè ê âåðõíåìó ðåãèñòðó, à âñå
îñòàëüíûå ñèìâîëû - ê íèæíåìó ðåãèñòðó. Èñõîäíàÿ ñòðîêà íå èçìåíÿåòñÿ.
Íàïðèìåð: 'ìÛÐáëÊÀ bsDSFc' -> 'Ìûðáëêà bsdsfc'. }
function Q_UpLowerStr(const S: string): string;
{ Q_ProperCaseInPlace èçìåíÿåò ñòðîêó S òàêèì îáðàçîì, ÷òî êàæäîå ñëîâî áóäåò
íà÷èíàòüñÿ ñ áîëüøîé, à ïðîäîëæàòüñÿ ìàëåíüêèìè áóêâàìè (ïåðâàÿ áóêâà êàæäîãî
ñëîâà ïðåîáðàçóåòñÿ ê âåðõíåìó ðåãèñòðó, à îñòàëüíûå áóêâû - ê íèæíåìó
ðåãèñòðó). Èñõîäíàÿ ñòðîêà S èçìåíÿåòñÿ. Â ñòðîêå Delimiters ïåðåäàþòñÿ
ñèìâîëû, êîòîðûå ðàññìàòðèâàþòñÿ êàê ðàçäåëèòåëè ñëîâ â ñòðîêå S. Åñëè
Delimiters ðàâíà ïóñòîé ñòðîêå, èñïîëüçóåòñÿ ñïèñîê ðàçäåëèòåëåé, êîòîðûå
áûëè çàäàíû â õîäå ïðåäûäóùåãî âûçîâà îäíîé èç ñëåäóþùèõ ôóíêöèé Q_StrTok,
Q_StrSpn, Q_StrCSpn, Q_ProperCase, Q_ProperCaseInPlace, Q_WordAtPos,
Q_GetWordN, Q_SetDelimiters, Q_CountOfWords. Åñëè ðàçäåëèòåëè ïåðåäàþòñÿ
â âèäå ìíîæåñòâà, îíè íå çàïîìèíàþòñÿ äëÿ ïîñëåäóþùèõ âûçîâîâ ôóíêöèé. }
procedure Q_ProperCaseInPlace(var S: string; const Delimiters: string); overload;
procedure Q_ProperCaseInPlace(var S: string;
const Delimiters: TCharSet = Q_SP); overload;
{ Q_ProperCase âîçâðàùàåò ñòðîêó S, ïðåîáðàçîâàííóþ òàêèì îáðàçîì, ÷òî êàæäîå
ñëîâî íà÷èíàåòñÿ ñ áîëüøîé áóêâû (ïåðâàÿ áóêâà êàæäîãî ñëîâà ïåðåâîäèòñÿ â
âåðõíèé ðåãèñòð, à îñòàëüíûå áóêâû - â íèæíèé ðåãèñòð). Â ñòðîêå Delimiters
ïåðåäàþòñÿ ñèìâîëû, êîòîðûå ðàññìàòðèâàþòñÿ êàê ðàçäåëèòåëè ñëîâ â ñòðîêå S.
Íàïðèìåð, âûçîâ ôóíêöèè Q_ProperCase('ñðåäñòâà ÈÍÒÅÐÍÅÒÀ',' ') âåðíåò ñòðîêó
'Ñðåäñòâà Èíòåðíåòà'. Åñëè Delimiters ðàâíà ïóñòîé ñòðîêå, èñïîëüçóåòñÿ
ñïèñîê ðàçäåëèòåëåé, êîòîðûå áûëè çàäàíû â õîäå ïðåäûäóùåãî âûçîâà îäíîé èç
ñëåäóþùèõ ôóíêöèé: Q_ProperCaseInPlace, Q_ProperCase, Q_StrTok, Q_StrSpn,
Q_StrCSpn, Q_WordAtPos, Q_GetWordN, Q_SetDelimiters, Q_CountOfWords. Åñëè
ðàçäåëèòåëè ïåðåäàþòñÿ â âèäå ìíîæåñòâà, îíè íå çàïîìèíàþòñÿ äëÿ ïîñëåäóþùèõ
âûçîâîâ ôóíêöèé. }
function Q_ProperCase(const S, Delimiters: string): string; overload;
function Q_ProperCase(const S: string;
const Delimiters: TCharSet = Q_SP): string; overload;
{ Ôóíêöèè ïåðåêîäèðîâêè ñòðîê: èç DOS â Windows è íàîáîðîò. }
{ Q_StrToAnsi ïåðåâîäèò ñòðîêó S èç êîäèðîâêè DOS â êîäèðîâêó Windows. Ïðè
ýòîì èçìåíÿåòñÿ èñõîäíàÿ ñòðîêà. Q_PStrToAnsi àíàëîãè÷íà ïðîöåäóðå
Q_StrToAnsi äëÿ PChar è Pointer(String), çà èñêëþ÷åíèåì òîãî, ÷òî îíà
äîïîëíèòåëüíî âîçâðàùàåò óêàçàòåëü íà íà÷àëî ñòðîêè. }
procedure Q_StrToAnsi(var S: string);
function Q_PStrToAnsi(P: PChar): PChar;
{ Q_StrToOem ïåðåâîäèò ñòðîêó S èç êîäèðîâêè Windows â êîäèðîâêó DOS. Ïðè
ýòîì èçìåíÿåòñÿ èñõîäíàÿ ñòðîêà. Ôóíêöèÿ Q_PStrToOem àíàëîãè÷íà ïðîöåäóðå
Q_StrToOem äëÿ PChar è Pointer(String), çà èñêëþ÷åíèåì òîãî, ÷òî îíà
äîïîëíèòåëüíî âîçâðàùàåò óêàçàòåëü íà íà÷àëî ñòðîêè. }
procedure Q_StrToOem(var S: string);
function Q_PStrToOem(P: PChar): PChar;
{ Q_PStrToAnsiL ïåðåâîäèò L ïåðâûõ ñèìâîëîâ ñòðîêè, óêàçûâàåìîé ïàðàìåòðîì P,
èç êîäèðîâêè DOS â êîäèðîâêó Windows. Ïðè ýòîì èçìåíÿåòñÿ èñõîäíàÿ ñòðîêà.
Ôóíêöèÿ âîçâðàùàåò óêàçàòåëü íà íà÷àëî ñòðîêè. }
function Q_PStrToAnsiL(P: PChar; L: Cardinal): PChar;
{ Q_PStrToOemL ïåðåâîäèò L ïåðâûõ ñèìâîëîâ ñòðîêè, óêàçûâàåìîé ïàðàìåòðîì P,
èç êîäèðîâêè Windows â êîäèðîâêó DOS. Ïðè ýòîì èçìåíÿåòñÿ èñõîäíàÿ ñòðîêà.
Ôóíêöèÿ âîçâðàùàåò óêàçàòåëü íà íà÷àëî ñòðîêè. }
function Q_PStrToOemL(P: PChar; L: Cardinal): PChar;
{ Q_Str2ToAnsi ïåðåâîäèò ñòðîêó Source èç êîäèðîâêè DOS â êîäèðîâêó Windows.
Ðåçóëüòàò ñîõðàíÿåòñÿ â ñòðîêå Dest. Q_PStr2ToAnsi àíàëîãè÷íà ïðîöåäóðå
Q_Str2ToAnsi äëÿ PChar è Pointer(String), çà èñêëþ÷åíèå òîãî, ÷òî îíà
äîïîëíèòåëüíî âîçâðàùàåò óêàçàòåëü íà íà÷àëî ñòðîêè-ïðèåìíèêà Dest. }
procedure Q_Str2ToAnsi(const Source: string; var Dest: string);
function Q_PStr2ToAnsi(Source, Dest: PChar): PChar;
{ Q_Str2ToOem ïåðåâîäèò ñòðîêó Source èç êîäèðîâêè Windows â êîäèðîâêó DOS.
Ðåçóëüòàò ñîõðàíÿåòñÿ â ñòðîêå Dest. Q_PStr2ToOem àíàëîãè÷íà ïðîöåäóðå
Q_Str2ToOem äëÿ PChar è Pointer(String), çà èñêëþ÷åíèå òîãî, ÷òî îíà
äîïîëíèòåëüíî âîçâðàùàåò óêàçàòåëü íà íà÷àëî ñòðîêè-ïðèåìíèêà Dest. }
procedure Q_Str2ToOem(const Source: string; var Dest: string);
function Q_PStr2ToOem(Source, Dest: PChar): PChar;
{ Q_PStr2ToAnsiL ïåðåâîäèò L ïåðâûõ ñèìâîëîâ ñòðîêè Source èç êîäèðîâêè
DOS â êîäèðîâêó Windows. Ðåçóëüòàò ñîõðàíÿåòñÿ â ñòðîêå Dest. Ôóíêöèÿ
âîçâðàùàåò óêàçàòåëü íà íà÷àëî ñòðîêè-ïðèåìíèêà Dest. }
function Q_PStr2ToAnsiL(Source, Dest: PChar; L: Cardinal): PChar;
{ Q_PStr2ToOemL ïåðåâîäèò L ïåðâûõ ñèìâîëîâ ñòðîêè Source èç êîäèðîâêè Windows
â êîäèðîâêó DOS. Ðåçóëüòàò ñîõðàíÿåòñÿ â ñòðîêå Dest. Ôóíêöèÿ âîçâðàùàåò
óêàçàòåëü íà íà÷àëî ñòðîêè-ïðèåìíèêà Dest. }
function Q_PStr2ToOemL(Source, Dest: PChar; L: Cardinal): PChar;
{ Q_ToAnsi ïåðåâîäèò ñòðîêó OemStr èç êîäèðîâêè DOS â êîäèðîâêó Windows. Ïðè
ýòîì èñõîäíàÿ ñòðîêà íå èçìåíÿåòñÿ. Ýòà ôóíêöèÿ ðàáîòàåò ìåäëåííåå, ÷åì
äðóãèå àíàëîãè÷íûå ôóíêöèè è ïðîöåäóðû èç ýòîãî ìîäóëÿ. }
function Q_ToAnsi(const OemStr: string): string;
{ Q_ToOem ïåðåâîäèò ñòðîêó AnsiStr èç êîäèðîâêè Windows â êîäèðîâêó DOS. Ïðè
ýòîì èñõîäíàÿ ñòðîêà íå èçìåíÿåòñÿ. Ýòà ôóíêöèÿ ðàáîòàåò ìåäëåííåå, ÷åì
äðóãèå àíàëîãè÷íûå ôóíêöèè è ïðîöåäóðû èç ýòîãî ìîäóëÿ. }
function Q_ToOem(const AnsiStr: string): string;
{ Ïîèñê, çàìåíà è óäàëåíèå ïîäñòðîê è îòäåëüíûõ ñèìâîëîâ. }
{ Q_PosStr íàõîäèò ïåðâîå âõîäåíèå ïîäñòðîêè FindString â ñòðîêå SourceString,
íà÷èíàÿ ñ ïîçèöèè StartPos. Âîçâðàùàåòñÿ íîìåð ñèìâîëà, ñ êîòîðîãî íà÷èíàåòñÿ
âõîæäåíèå èëè 0, åñëè ïîäñòðîêà FindString íå íàéäåíà â ñòðîêå SourceString.
Ïîèñê ïîäñòðîêè ïðîèçâîäèòñÿ ñ ó÷åòîì ðåãèñòðà (áîëüøèå è ìàëåíüêèå áóêâû
ðàçëè÷àþòñÿ). Àâòîð àëãîðèòìà - Peter Morris (UK) (ìîäóëü FastStrings). }
function Q_PosStr(const FindString, SourceString: string;
StartPos: Integer = 1): Integer;
{ Q_PosText íàõîäèò ïåðâîå âõîäåíèå ïîäñòðîêè FindString â ñòðîêå SourceString,
íà÷èíàÿ ñ ïîçèöèè StartPos. Âîçâðàùàåòñÿ íîìåð ñèìâîëà, ñ êîòîðîãî íà÷èíàåòñÿ
âõîæäåíèå èëè 0, åñëè ïîäñòðîêà FindString íå íàéäåíà â ñòðîêå SourceString.
Ïîèñê ïîäñòðîêè ïðîèçâîäèòñÿ áåç ó÷åòà ðåãèñòðà (áîëüøèå è ìàëåíüêèå áóêâû
íå ðàçëè÷àþòñÿ). Àâòîð àëãîðèòìà - Peter Morris (UK) (ìîäóëü FastStrings). }
function Q_PosText(const FindString, SourceString: string;
StartPos: Integer = 1): Integer;
{ Q_PosLastStr íàõîäèò ïîñëåäíåå âõîäåíèå ïîäñòðîêè FindString â ñòðîêå
SourceString, ïîëàãàÿ, ÷òî ñëåäóþùåå âõîæäåíèå áûëî íàéäåíî â ïîçèöèè
LastPos. Âîçâðàùàåòñÿ íîìåð ñèìâîëà, ñ êîòîðîãî íà÷èíàåòñÿ èñêîìàÿ ïîäñòðîêà
èëè 0, åñëè äàííàÿ ïîäñòðîêà íå íàéäåíà ðàíåå (ëåâåå) óêàçàííîé ïîçèöèè.
Ïðåäïîëàãàåòñÿ, ÷òî îòäåëüíûå âõîæäåíèÿ ïîäñòðîêè íå ïåðåêðûâàþò äðóã äðóãà.
Ïîèñê ïîäñòðîêè ïðîèçâîäèòñÿ ñ ó÷åòîì ðåãèñòðà (áîëüøèå è ìàëåíüêèå áóêâû
ðàçëè÷àþòñÿ). Åñëè LastPos ïðåâûøàåò äëèíó ñòðîêè SourceString, òî èùåòñÿ
ñàìîå ïîñëåäíåå âõîæäåíèå ïîäñòðîêè FindString. }
function Q_PosLastStr(const FindString, SourceString: string;
LastPos: Integer = MaxInt): Integer;
{ Q_PosLastText íàõîäèò ïîñëåäíåå âõîäåíèå ïîäñòðîêè FindString â ñòðîêå
SourceString, ïîëàãàÿ, ÷òî ñëåäóþùåå âõîæäåíèå áûëî íàéäåíî â ïîçèöèè
LastPos. Âîçâðàùàåòñÿ íîìåð ñèìâîëà, ñ êîòîðîãî íà÷èíàåòñÿ èñêîìàÿ ïîäñòðîêà
èëè 0, åñëè äàííàÿ ïîäñòðîêà íå íàéäåíà ðàíåå (ëåâåå) óêàçàííîé ïîçèöèè.
Ïðåäïîëàãàåòñÿ, ÷òî îòäåëüíûå âõîæäåíèÿ ïîäñòðîêè íå ïåðåêðûâàþò äðóã äðóãà.
Ïîèñê ïîäñòðîêè ïðîèçâîäèòñÿ áåç ó÷åòà ðåãèñòðà (áîëüøèå è ìàëåíüêèå áóêâû
íå ðàçëè÷àþòñÿ). Åñëè LastPos ïðåâûøàåò äëèíó ñòðîêè SourceString, òî
èùåòñÿ ñàìîå ïîñëåäíåå âõîæäåíèå ïîäñòðîêè FindString. }
function Q_PosLastText(const FindString, SourceString: string;
LastPos: Integer = MaxInt): Integer;
{ Ôóíêöèè Q_TablePosXXX ìîæíî èñïîëüçîâàòü äëÿ ìíîãîêðàòíîãî ïîèñêà ïîäñòðîêè
â ñòðîêå (îäíîé èëè ìíîãèõ), êîãäà ïîäñòðîêà ñîñòîèò èç íåñêîëüêèõ ñèìâîëîâ.
Ýòè ôóíêöèè ïðåäñòàâëÿþò ñîáîé îäíó èç ðåàëèçàöèé àëãîðèòìà ïîèñêà ïîäñòðîê,
íàçûâàåìîãî "Boyer-Moore pattern searching algorithm". Ñíà÷àëà âûçûâàåòñÿ
ïðîöåäóðà òèïà Q_InitTablePosXXX äëÿ çàäàíèÿ èñêîìîé ïîäñòðîêè, à çàòåì
ñîîòâåòñòâóþùàÿ ôóíêöèÿ Q_TablePosXXX äëÿ ôàêòè÷åñêîãî ïîèñêà ïîäñòðîêè â
ñòðîêå. Ýòà âòîðàÿ ôóíêöèÿ ìîæåò âûçûâàòüñÿ ìíîãîêðàòíî äëÿ ïîèñêà íåêîòîðîãî
ôðàãìåíòà âî ìíîãèõ ñòðîêàõ èëè äëÿ ïîèñêà íåñêîëüêèõ âõîæäåíèé ïîäñòðîêè â
îäíó ñòðîêó. Âñå ôóíêöèè è ïðîöåäóðû ÿâëÿþòñÿ ïîòîêîáåçîïàñíûìè, ò.å.
Q_TablePosXXX ðàáîòàåò òîëüêî ñ ïîäñòðîêîé, êîòîðàÿ áûëà óêàçàíà ïðè âûçîâå
Q_InitTablePosXXX â òîì æå ïîòîêå. Îäíîâðåìåííî ïîèñê ìîæåò ïðîâîäèòüñÿ
â äðóãîì ïîòîêå, ÷òî íèêàê íå ïîâëèÿåò íà òåêóùèé ïîòîê. Ñëåäóåò îòìåòèòü,
÷òî Q_InitTablePosStr è Q_InitTablePosText èñïîëüçóþò îäíó è òó æå îáëàñòü
ïàìÿòè äëÿ õðàíåíèÿ èñêîìîé ïîäñòðîêè. Òàêèì îáðàçîì, íåëüçÿ ñìåøèâàòü ïîèñê
ïîäñòðîêè ñ ó÷åòîì è áåç ó÷åòà ðåãèñòðà. Ñêîðîñòü ðàáîòû ýòèõ ôóíêöèé ìîæåò
áûòü ðàçëè÷íîé â çàâèñèìîñòè îò äëèíû ïîäñòðîêè è íàáîðà âõîäÿùèõ â íåå
ñèìâîëîâ. Âî ìíîãèõ ñëó÷àÿõ ýòè ôóíêöèè ðàáîòàþò áûñòðåå, ÷åì Q_PosStr è
Q_PosText, íî ÷àùå áûâàåò íàîáîðîò. }
{ Q_InitTablePosStr èíèöèèðóåò ïîèñê ïîäñòðîêè â ñòðîêå ñ ó÷åòîì ðåãèñòðà
ñèìâîëîâ. Ýòà ïðîöåäóðà äîëæíà áûòü âûçâàíà äëÿ çàäàíèÿ èñêîìîé ïîäñòðîêè
ïåðåä òåì, êàê áóäåò âûçûâàòüñÿ ôóíêöèÿ Q_TablePosStr. }
procedure Q_InitTablePosStr(const FindString: string);
{ Q_TablePosStr íàõîäèò â ñòðîêå SourceString ïîäñòðîêó, îïðåäåëåííóþ ïðè
âûçîâå Q_InitTablePosStr. Â ïàðàìåòðå LastPos ïåðåäàåòñÿ íîìåð ñèìâîëà,
ñ êîòîðîãî íà÷èíàëîñü ïðåäûäóùåå íàéäåííîå âõîæäåíèå ýòîé ïîäñòðîêè â
ñòðîêå SourceString. Â ýòîì æå ïàðàìåòðå âîçâðàùàåòñÿ ïîçèöèÿ íîâîãî
î÷åðåäíîãî âõîæäåíèÿ èñêîìîé ïîäñòðîêè. Ïåðâîíà÷àëüíî, çíà÷åíèå ïàðàìåòðà
LastPos äîëæíî áûòü ðàâíî íóëþ. Åñëè ïîäñòðîêà íàéäåíà, ôóíêöèÿ
Q_TablePosStr âîçâðàùàåò True, èíà÷å - False. Åñëè ïîäñòðîêà íå íàéäåíà,
çíà÷åíèå ïàðàìåòðà LastPos íå èçìåíÿåòñÿ. }
function Q_TablePosStr(const SourceString: string; var LastPos: Integer): Boolean;
{ Q_InitTablePosText èíèöèèðóåò ïîèñê ïîäñòðîêè â ñòðîêå áåç ó÷åòà
ðåãèñòðà ñèìâîëîâ. Ýòà ïðîöåäóðà äîëæíà áûòü âûçâàíà äëÿ çàäàíèÿ èñêîìîé
ïîäñòðîêè ïåðåä òåì, êàê áóäåò âûçûâàòüñÿ ôóíêöèÿ Q_TablePosText. }
procedure Q_InitTablePosText(const FindString: string);
{ Q_TablePosText íàõîäèò â ñòðîêå SourceString ïîäñòðîêó, îïðåäåëåííóþ ïðè
âûçîâå Q_InitTablePosText. Â ïàðàìåòðå LastPos ïåðåäàåòñÿ íîìåð ñèìâîëà,
ñ êîòîðîãî íà÷èíàëîñü ïðåäûäóùåå íàéäåííîå âõîæäåíèå ýòîé ïîäñòðîêè â
ñòðîêå SourceString. Â ýòîì æå ïàðàìåòðå âîçâðàùàåòñÿ ïîçèöèÿ íîâîãî
î÷åðåäíîãî âõîæäåíèÿ èñêîìîé ïîäñòðîêè. Ïåðâîíà÷àëüíî, çíà÷åíèå ïàðàìåòðà
LastPos äîëæíî áûòü ðàâíî íóëþ. Åñëè ïîäñòðîêà íàéäåíà, ôóíêöèÿ
Q_TablePosText âîçâðàùàåò True, èíà÷å - False. Åñëè ïîäñòðîêà íå íàéäåíà,
çíà÷åíèå ïàðàìåòðà LastPos íå èçìåíÿåòñÿ. }
function Q_TablePosText(const SourceString: string; var LastPos: Integer): Boolean;
{ Q_ReplaceStr çàìåíÿåò âñå âõîäåíèÿ ïîäñòðîêè FindString â ñòðîêå SourceString
ïîäñòðîêîé ReplaceString. Ïîèñê ïîäñòðîêè ïðîèçâîäèòñÿ ñ ó÷åòîì ðåãèñòðà
(áîëüøèå è ìàëåíüêèå áóêâû ðàçëè÷àþòñÿ). Ôóíêöèÿ âîçâðàùàåò ñòðîêó-ðåçóëüòàò.
Åñëè ïîäñòðîêà FindString îòñóòñòâóåò â ñòðîêå SourceString, òî âîçâðàùàåòñÿ
èñõîäíàÿ ñòðîêà SourceString. }
function Q_ReplaceStr(const SourceString, FindString, ReplaceString: string): string;
{ Q_ReplaceText çàìåíÿåò âñå âõîäåíèÿ ïîäñòðîêè FindString â ñòðîêå
SourceString ïîäñòðîêîé ReplaceString. Ïîèñê ïîäñòðîêè ïðîèçâîäèòñÿ áåç ó÷åòà
ðåãèñòðà (áîëüøèå è ìàëåíüêèå áóêâû íå ðàçëè÷àþòñÿ). Ôóíêöèÿ âîçâðàùàåò
ñòðîêó-ðåçóëüòàò. Åñëè ïîäñòðîêà FindString îòñóòñòâóåò â ñòðîêå SourceString,
òî âîçâðàùàåòñÿ èñõîäíàÿ ñòðîêà SourceString. }
function Q_ReplaceText(const SourceString, FindString, ReplaceString: string): string;
{ Q_ReplaceFirstStr çàìåíÿåò ïåðâîå âõîæäåíèå ïîäñòðîêè FindString â ñòðîêå
SourceString ïîäñòðîêîé ReplaceString. Ïîäñòðîêà FindString èùåòñÿ, íà÷èíàÿ
ñ ñèìâîëà S[StartPos]. Íîìåð ñèìâîëà, ñ êîòîðîãî íà÷èíàåòñÿ íàéäåííîå âõîæ-
äåíèå ïîäñòðîêè, âîçâðàùàåòñÿ êàê ðåçóëüòàò ôóíêöèè (èëè íîëü, åñëè ïîäñòðîêà
íå íàéäåíà). Ïîèñê ïîäñòðîêè FindString âûïîëíÿåòñÿ ñ ó÷åòîì ðåãèñòðà
ñèìâîëîâ (áîëüøèå è ìàëåíüêèå áóêâû ðàçëè÷àþòñÿ). }
function Q_ReplaceFirstStr(var S: string; const FindString, ReplaceString: string;
StartPos: Integer = 1): Integer;
{ Q_ReplaceFirstText çàìåíÿåò ïåðâîå âõîæäåíèå ïîäñòðîêè FindString â ñòðîêå
SourceString ïîäñòðîêîé ReplaceString. Ïîäñòðîêà FindString èùåòñÿ, íà÷èíàÿ
ñ ñèìâîëà S[StartPos]. Íîìåð ñèìâîëà, ñ êîòîðîãî íà÷èíàåòñÿ íàéäåííîå âõîæ-
äåíèå ïîäñòðîêè, âîçâðàùàåòñÿ êàê ðåçóëüòàò ôóíêöèè (èëè íîëü, åñëè ïîäñòðîêà
íå íàéäåíà). Ïîèñê ïîäñòðîêè FindString âûïîëíÿåòñÿ áåç ó÷åòà ðåãèñòðà
ñèìâîëîâ (áîëüøèå è ìàëåíüêèå áóêâû íå ðàçëè÷àþòñÿ). }
function Q_ReplaceFirstText(var S: string; const FindString, ReplaceString: string;
StartPos: Integer = 1): Integer;
{ Q_ReplaceLastStr çàìåíÿåò ïîñëåäíåå âõîæäåíèå ïîäñòðîêè FindString â ñòðîêå
SourceString ïîäñòðîêîé ReplaceString. Ïîäñòðîêà FindString èùåòñÿ ñëåâà îò
ñèìâîëà S[LastPos] (ò.å. âî ôðàãìåíòå Copy(S, 1, LastPos-1)). Íîìåð ñèìâîëà,
ñ êîòîðîãî íà÷èíàåòñÿ íàéäåííîå âõîæäåíèå, âîçâðàùàåòñÿ êàê ðåçóëüòàò ôóíêöèè
(èëè íîëü, åñëè ïîäñòðîêà íå íàéäåíà). Ïîèñê ïîäñòðîêè FindString âûïîëíÿåòñÿ
ñ ó÷åòîì ðåãèñòðà ñèìâîëîâ (áîëüøèå è ìàëåíüêèå áóêâû ðàçëè÷àþòñÿ). Åñëè
LastPos ïðåâûøàåò äëèíó ñòðîêè S, òî çàìåíÿåòñÿ ñàìîå ïîñëåäíåå âõîæäåíèå
èñêîìîé ïîäñòðîêè. }
function Q_ReplaceLastStr(var S: string; const FindString, ReplaceString: string;
LastPos: Integer = MaxInt): Integer;
{ Q_ReplaceLastText çàìåíÿåò ïîñëåäíåå âõîæäåíèå ïîäñòðîêè FindString â ñòðîêå
SourceString ïîäñòðîêîé ReplaceString. Ïîäñòðîêà FindString èùåòñÿ ñëåâà îò
ñèìâîëà S[LastPos] (ò.å. âî ôðàãìåíòå Copy(S, 1, LastPos-1)). Íîìåð ñèìâîëà,
ñ êîòîðîãî íà÷èíàåòñÿ íàéäåííîå âõîæäåíèå, âîçâðàùàåòñÿ êàê ðåçóëüòàò ôóíêöèè
(èëè íîëü, åñëè ïîäñòðîêà íå íàéäåíà). Ïîèñê ïîäñòðîêè FindString âûïîëíÿåòñÿ
áåç ó÷åòà ðåãèñòðà ñèìâîëîâ (áîëüøèå è ìàëåíüêèå áóêâû íå ðàçëè÷àþòñÿ). Åñëè
LastPos ïðåâûøàåò äëèíó ñòðîêè S, òî çàìåíÿåòñÿ ñàìîå ïîñëåäíåå âõîæäåíèå
èñêîìîé ïîäñòðîêè. }
function Q_ReplaceLastText(var S: string; const FindString, ReplaceString: string;
LastPos: Integer = MaxInt): Integer;
{ Q_DeleteStr óäàëÿåò èç ñòðîêè S âñå âõîæäåíèÿ ïîäñòðîêè SubStrToDel. Ïîèñê
ïîäñòðîêè âåäåòñÿ ñ ó÷åòîì ðåãèñòðà ñèìâîëîâ. Ôóíêöèÿ âîçâðàùàåò êîëè÷åñòâî
íàéäåííûõ (è óäàëåííûõ) ôðàãìåíòîâ. }
function Q_DeleteStr(var S: string; const SubStrToDel: string): Integer;
{ Q_DeleteText óäàëÿåò èç ñòðîêè S âñå âõîæäåíèÿ ïîäñòðîêè SubStrToDel. Ïîèñê
ïîäñòðîêè âåäåòñÿ áåç ó÷åòà ðåãèñòðà ñèìâîëîâ. Ôóíêöèÿ âîçâðàùàåò êîëè÷åñòâî
íàéäåííûõ (è óäàëåííûõ) ôðàãìåíòîâ. }
function Q_DeleteText(var S: string; const SubStrToDel: string): Integer;
{ Q_DeleteFirstStr óäàëÿåò ïåðâîå âõîæäåíèå ïîäñòðîêè SubStrToDel èç ñòðîêè
SourceString. Ïîäñòðîêà SubStrToDel èùåòñÿ, íà÷èíàÿ ñ ñèìâîëà S[StartPos].
Íîìåð ñèìâîëà, ñ êîòîðîãî íà÷èíàåòñÿ íàéäåííîå âõîæäåíèå ïîäñòðîêè, âîçâðà-
ùàåòñÿ êàê ðåçóëüòàò ôóíêöèè (èëè íîëü, åñëè ïîäñòðîêà íå íàéäåíà). Ïîèñê
ïîäñòðîêè SubStrToDel âûïîëíÿåòñÿ ñ ó÷åòîì ðåãèñòðà ñèìâîëîâ (áîëüøèå è
ìàëåíüêèå áóêâû ðàçëè÷àþòñÿ). }
function Q_DeleteFirstStr(var S: string; const SubStrToDel: string; StartPos:
Integer = 1): Integer;
{ Q_DeleteFirstText óäàëÿåò ïåðâîå âõîæäåíèå ïîäñòðîêè SubStrToDel èç ñòðîêè
SourceString. Ïîäñòðîêà SubStrToDel èùåòñÿ, íà÷èíàÿ ñ ñèìâîëà S[StartPos].
Íîìåð ñèìâîëà, ñ êîòîðîãî íà÷èíàåòñÿ íàéäåííîå âõîæäåíèå ïîäñòðîêè, âîçâðà-
ùàåòñÿ êàê ðåçóëüòàò ôóíêöèè (èëè íîëü, åñëè ïîäñòðîêà íå íàéäåíà). Ïîèñê
ïîäñòðîêè SubStrToDel âûïîëíÿåòñÿ áåç ó÷åòà ðåãèñòðà ñèìâîëîâ (áîëüøèå è
ìàëåíüêèå áóêâû íå ðàçëè÷àþòñÿ). }
function Q_DeleteFirstText(var S: string; const SubStrToDel: string; StartPos:
Integer = 1): Integer;
{ Q_DeleteLastStr óäàëÿåò ïîñëåäíåå âõîæäåíèå ïîäñòðîêè SubStrToDel â ñòðîêå
SourceString. Ïîäñòðîêà SubStrToDel èùåòñÿ ñëåâà îò ñèìâîëà S[LastPos]
(âî ôðàãìåíòå Copy(S, 1, LastPos-1)). Íîìåð ñèìâîëà, ñ êîòîðîãî íà÷èíàåòñÿ
íàéäåííîå âõîæäåíèå ïîäñòðîêè, âîçâðàùàåòñÿ êàê ðåçóëüòàò ôóíêöèè (èëè íîëü,
åñëè ïîäñòðîêà íå íàéäåíà). Ïîèñê ïîäñòðîêè SubStrToDel âûïîëíÿåòñÿ ñ ó÷åòîì
ðåãèñòðà ñèìâîëîâ (áîëüøèå è ìàëåíüêèå áóêâû ðàçëè÷àþòñÿ). }
function Q_DeleteLastStr(var S: string; const SubStrToDel: string; LastPos:
Integer = MaxInt): Integer;
{ Q_DeleteLastText óäàëÿåò ïîñëåäíåå âõîæäåíèå ïîäñòðîêè SubStrToDel â ñòðîêå
SourceString. Ïîäñòðîêà SubStrToDel èùåòñÿ ñëåâà îò ñèìâîëà S[LastPos]
(âî ôðàãìåíòå Copy(S, 1, LastPos-1)). Íîìåð ñèìâîëà, ñ êîòîðîãî íà÷èíàåòñÿ
íàéäåííîå âõîæäåíèå ïîäñòðîêè, âîçâðàùàåòñÿ êàê ðåçóëüòàò ôóíêöèè (èëè íîëü,
åñëè ïîäñòðîêà íå íàéäåíà). Ïîèñê ïîäñòðîêè SubStrToDel âûïîëíÿåòñÿ áåç
ó÷åòà ðåãèñòðà ñèìâîëîâ (áîëüøèå è ìàëåíüêèå áóêâû íå ðàçëè÷àþòñÿ). }
function Q_DeleteLastText(var S: string; const SubStrToDel: string; LastPos:
Integer = MaxInt): Integer;
{ Q_ReplaceChar çàìåíÿåò â ñòðîêå S êàæäîå âõîæäåíèå ñèìâîëà ChOld íà ñèìâîë
ChNew. Ðåçóëüòàò ôóíêöèè ðàâåí êîëè÷åñòâó ïðîèçâåäåííûõ çàìåí. Èñõîäíàÿ
ñòðîêà S èçìåíÿåòñÿ. }
function Q_ReplaceChar(var S: string; ChOld, ChNew: Char): Integer;
{ Q_ReplaceChars çàìåíÿåò â ñòðîêå S âñå ñèìâîëû èç ñòðîêè StrChOld ñîîòâåòñò-
âóþùèìè ñèìâîëàìè èç ñòðîêè StrChNew. Èñõîäíàÿ ñòðîêà S èçìåíÿåòñÿ. Åñëè
÷èñëî ñèìâîëîâ â ñòðîêå StrChOld íå ðàâíî ÷èñëó ñèìâîëîâ â ñòðîêå StrChNew,
âîçíèêàåò èñêëþ÷èòåëüíàÿ ñèòóàöèÿ òèïà Exception. }
procedure Q_ReplaceChars(var S: string; const StrChOld, StrChNew: string);
{ Q_ReplaceCharsByOneChar çàìåíÿåò âñå ïîäðÿä èäóùèå âõîæäåíèÿ ñèìâîëîâ èç
ìíîæåñòâà ChOldSet â ñòðîêå S îäíèì ñèìâîëîì ChNew. Èñõîäíàÿ ñòðîêà S ïðè
ýòîì èçìåíÿåòñÿ. Åñëè íàäî çàìåíèòü íåñêîëüêî ñèìâîëîâ îäíèì áåç óäàëåíèÿ
ïîâòîðåíèé, âîñïîëüçóéòåñü ïðîöåäóðîé Q_ReplaceChars. }
procedure Q_ReplaceCharsByOneChar(var S: string; const ChOldSet: TCharSet;
ChNew: Char);
{ Q_StrScan íàõîäèò ïåðâîå âõîæäåíèå ñèìâîëà Ch â ñòðîêó S, íà÷èíàÿ ñ ñèìâîëà
íîìåð StartPos. Âîçâðàùàåò íîìåð íàéäåííîãî ñèìâîëà èëè íîëü, åñëè ñèìâîë Ch
â ñòðîêå S íå íàéäåí. Ôóíêöèÿ Q_PStrScan àíàëîãè÷íà Q_StrScan äëÿ
Pointer(String). }
function Q_StrScan(const S: string; Ch: Char; StartPos: Integer = 1): Integer;
function Q_PStrScan(P: Pointer; Ch: Char; StartPos: Integer = 1): Integer;
{ Q_StrRScan íàõîäèò ïðåäûäóùåå âõîæäåíèå ñèìâîëà Ch â ñòðîêó S. Â ïàðàìåòðå
LastPos ïåðåäàåòñÿ íîìåð ñèìâîëà, ñîîòâåòñòâóþùèé òåêóùåìó âõîæäåíèþ Ch â
ñòðîêó S. Ïîèñê íà÷èíàåòñÿ ñ ñèìâîëà, ïðåäøåñòâóþùåãî ñèìâîëó S[LastPos] èëè
ñ ïîñëåäíåãî ñèìâîëà ñòðîêè, åñëè LastPos ïðåâûøàåò äëèíó ñòðîêè S. Ôóíêöèÿ
âîçâðàùàåò íîìåð íàéäåííîãî ñèìâîëà èëè íîëü, åñëè ñèìâîë Ch íå íàéäåí â
ñòðîêå S ëåâåå ñèìâîëà ñ íîìåðîì LastPos. Ôóíêöèÿ Q_PStrRScan àíàëîãè÷íà
Q_StrRScan äëÿ Pointer(String). }
function Q_StrRScan(const S: string; Ch: Char; LastPos: Integer = MaxInt): Integer;
function Q_PStrRScan(P: Pointer; Ch: Char; LastPos: Integer = MaxInt): Integer;
{ Q_StrSpn âîçâðàùàåò íîìåð ïåðâîãî ñèìâîëà ñòðîêè S, íå âõîäÿùåãî â ñòðîêó
Delimiters, íà÷èíàÿ ñ ñèìâîëà íîìåð StartPos. Ñòðîêà Delimiters çàäàåò
ìíîæåñòâî ñèìâîëîâ-ðàçäåëèòåëåé, à ôóíêöèÿ íàõîäèò ïåðâûé ñèìâîë,
íå ÿâëÿþùèéñÿ ðàçäåëèòåëåì. Åñëè îáû÷íûå ñèìâîëû â ñòðîêå S îòñóòñòâóþò,
âîçâðàùàåòñÿ íîëü. Åñëè Delimiters ðàâíà ïóñòîé ñòðîêå, èñïîëüçóåòñÿ ñïèñîê
ðàçäåëèòåëåé, êîòîðûå áûëè çàäàíû â õîäå ïðåäûäóùåãî âûçîâà îäíîé èç
ñëåäóþùèõ ôóíêöèé: Q_StrTok, Q_StrSpn, Q_StrCSpn, Q_ProperCase, Q_WordAtPos,
Q_GetWordN, Q_ProperCaseInPlace, Q_SetDelimiters, Q_CountOfWords. Åñëè
ðàçäåëèòåëè ïåðåäàþòñÿ â âèäå ìíîæåñòâà òèïà TCharSet, îíè íå çàïîìèíàþòñÿ
äëÿ ïîñëåäóþùèõ âûçîâîâ ôóíêöèé. }
function Q_StrSpn(const S, Delimiters: string; StartPos: Cardinal = 1): Integer; overload;
function Q_StrSpn(const S: string; StartPos: Cardinal = 1;
const Delimiters: TCharSet = Q_SP): Integer; overload;
{ Q_StrCSpn âîçâðàùàåò íîìåð ïåðâîãî ñèìâîëà ñòðîêè S, âõîäÿùåãî â ñòðîêó
Delimiters, íà÷èíàÿ ñ ñèìâîëà íîìåð StartPos. Ñòðîêà Delimiters çàäàåò
ìíîæåñòâî ñèìâîëîâ-ðàçäåëèòåëåé, à ôóíêöèÿ íàõîäèò ïåðâûé ñèìâîë-ðàçäåëèòåëü.
Åñëè ñèìâîëû-ðàçäåëèòåëè â ñòðîêå S îòñóòñòâóþò, âîçâðàùàåòñÿ íîëü. Åñëè
Delimiters ðàâíà ïóñòîé ñòðîêå, èñïîëüçóåòñÿ ñïèñîê ðàçäåëèòåëåé, êîòîðûå
áûëè çàäàíû â õîäå ïðåäûäóùåãî âûçîâà îäíîé èç ñëåäóþùèõ ôóíêöèé: Q_StrTok,
Q_StrSpn, Q_StrCSpn, Q_ProperCase, Q_ProperCaseInPlace, Q_WordAtPos,
Q_GetWordN, Q_SetDelimiters, Q_CountOfWords. Åñëè ðàçäåëèòåëè ïåðåäàþòñÿ
â âèäå ìíîæåñòâà, îíè íå çàïîìèíàþòñÿ äëÿ ïîñëåäóþùèõ âûçîâîâ ôóíêöèé. }
function Q_StrCSpn(const S, Delimiters: string; StartPos: Cardinal = 1): Integer; overload;
function Q_StrCSpn(const S: string; StartPos: Cardinal = 1;
const Delimiters: TCharSet = Q_SP): Integer; overload;
{ Q_DelCharInPlace óäàëÿåò âñå ñèìâîëû Ch èç ñòðîêè S. Èñõîäíàÿ ñòðîêà ïðè
ýòîì èçìåíÿåòñÿ. }
procedure Q_DelCharInPlace(var S: string; Ch: Char = ' ');
{ Q_DelChar óäàëÿåò âñå ñèìâîëû Ch èç ñòðîêè, ïåðåäàííîé ïàðàìåòðîì S. }
function Q_DelChar(const S: string; Ch: Char = ' '): string;
{ Q_Delete óäàëÿåò ïîäñòðîêó èç ñòðîêè S. Ïðè ýòîì èñõîäíàÿ ñòðîêà èçìåíÿåòñÿ.
Index - èíäåêñ ïåðâîãî óäàëÿåìîãî ñèìâîëà, Count - êîëè÷åñòâî ñèìâîëîâ,
ïîäëåæàùèõ óäàëåíèþ. Ýòà ôóíêöèÿ ðàáîòàåò áûñòðåå, ÷åì ñòàíäàðòíàÿ Delete. }
procedure Q_Delete(var S: string; Index, Count: Integer);
{ Q_DelChars óäàëÿåò èç ñòðîêè S ñèìâîëû, êîòîðûå ïðèñóòñòâóþò â ñòðîêå
(èëè ìíîæåñòâå) CharsToRemove. Èñõîäíàÿ ñòðîêà S èçìåíÿåòñÿ. }
procedure Q_DelChars(var S: string; const CharsToRemove: string); overload;
procedure Q_DelChars(var S: string; const CharsToRemove: TCharSet); overload;
{ Q_KeepChars îñòàâëÿåò â ñòðîêå S òîëüêî òå ñèìâîëû, êîòîðûå ïðèñóòñòâóþò â
ñòðîêå (èëè ìíîæåñòâå) CharsToKeep, îñòàëüíûå ñèìâîëû óäàëÿåò. Èñõîäíàÿ
ñòðîêà S èçìåíÿåòñÿ. }
procedure Q_KeepChars(var S: string; const CharsToKeep: string); overload;
procedure Q_KeepChars(var S: string; const CharsToKeep: TCharSet); overload;
{ Q_ApplyMask ïðèìåíÿåò ìàñêó Mask ê ñòðîêå SourceStr è âîçâðàùàåò ïîëó÷åííóþ
ñòðîêó êàê ðåçóëüòàò ôóíêöèè. Ñèìâîë MaskChar èñïîëüçóåòñÿ â ñòðîêå Mask äëÿ
óêàçàíèÿ ïîçèöèé, â êîòîðûõ ïîäñòàâëÿþòñÿ ñèìâîëû èç ñòðîêè SourceStr. Äëèíà
SourceStr äîëæíà áûòü ðàâíà êîëè÷åñòâó ñèìâîëîâ MaskChar â ìàñêå. Ïðèìåð:
Q_ApplyMask('(###) ##-##-##','075723293','#') âåðíåò ñòðîêó '(075) 72-32-93'.
Èäåÿ ýòîé è ñëåäóþùèõ òðåõ ôóíêöèé çàèìñòâîâàíà èç ìîäóëÿ jbStr.Pas, àâòîðîì
êîòîðîãî ÿâëÿåòñÿ Jaro Benes ([email protected]). }
function Q_ApplyMask(const Mask, SourceStr: string; MaskChar: Char = 'X'): string;
{ Q_ApplyMaskInPlace ïðèìåíÿåò ìàñêó Mask ê ñòðîêå SourceStr è ñîõðàíÿåò
ïîëó÷åííóþ ñòðîêó â ïåðåìåííîé Mask. Ñèìâîë MaskChar èñïîëüçóåòñÿ â ñòðîêå
Mask äëÿ óêàçàíèÿ ïîçèöèé, â êîòîðûõ ïîäñòàâëÿþòñÿ ñèìâîëû èç ñòðîêè
SourceStr. Äëèíà ñòðîêè SourceStr äîëæíà ñîîòâåòñòâîâàòü êîëè÷åñòâó ñèìâîëîâ
ïîäñòàíîâêè MaskChar â ìàñêå Mask. }
procedure Q_ApplyMaskInPlace(var Mask: string; const SourceStr: string;
MaskChar: Char = 'X');
{ Q_ExtractByMask óäàëÿåò èç ñòðîêè S âñå ñèìâîëû, ÿâëÿþùèåñÿ ôèêñèðîâàííûìè
äëÿ äàííîé ìàñêè Mask, îñòàâëÿÿ òîëüêî ïîäñòàâëåííûå ñèìâîëû, ò.å. ñèìâîëû,
êîòîðûì â ìàñêå ñîîòâåòñòâóåò ñèìâîë MaskChar. Ïîëó÷åííàÿ òàêèì îáðàçîì
ñòðîêà âîçâðàùàåòñÿ êàê ðåçóëüòàò ôóíêöèè. Äëèíà ñòðîê S è Mask äîëæíà áûòü
îäèíàêîâîé. Ïðèìåð: Q_ExtractByMask('7-35-01','X-XX-XX') âåðíåò '73501'. }
function Q_ExtractByMask(const S, Mask: string; MaskChar: Char = 'X'): string;
{ Q_ExtractByMaskInPlace óäàëÿåò èç ñòðîêè S âñå ñèìâîëû, ÿâëÿþùèåñÿ
ôèêñèðîâàííûìè äëÿ äàííîé ìàñêè Mask, îñòàâëÿÿ òîëüêî ïîäñòàâëåííûå ñèìâîëû,
ò.å. ñèìâîëû, êîòîðûì â ìàñêå ñîîòâåòñòâóåò ñèìâîë MaskChar. Ïîëó÷åííàÿ
òàêèì îáðàçîì ñòðîêà ñîõðàíÿåòñÿ â ïåðåìåííîé, ïåðåäàííîé ïàðàìåòðîì S.
Èñõîäíàÿ äëèíà ñòðîê S è Mask äîëæíà áûòü îäèíàêîâîé. }
procedure Q_ExtractByMaskInPlace(var S: string; const Mask: string;
MaskChar: Char = 'X');
{ Ôîðìàòèðîâàíèå ñòðîê, âûðåçêà ôðàãìåíòîâ ñòðîêè. }
{ Q_TrimInPlace óäàëÿåò âåäóùèå è êîíöåâûå ïðîáåëû è óïðàâëÿþùèå ñèìâîëû èç
ñòðîêè S. Ïðè ýòîì èñõîäíàÿ ñòðîêà èçìåíÿåòñÿ. Ýòà ïðîöåäóðà ðàáîòàåò
áûñòðåå, ÷åì ñòàíäàðòíàÿ ôóíêöèÿ Trim. }
procedure Q_TrimInPlace(var S: string);
{ Q_TrimLeftInPlace óäàëÿåò âåäóùèå ïðîáåëû è óïðàâëÿþùèå ñèìâîëû èç ñòðîêè S.
Ïðè ýòîì èñõîäíàÿ ñòðîêà èçìåíÿåòñÿ. Ýòà ïðîöåäóðà ðàáîòàåò áûñòðåå, ÷åì
ñòàíäàðòíàÿ ôóíêöèÿ TrimLeft. }
procedure Q_TrimLeftInPlace(var S: string);
{ Q_TrimRightInPlace óäàëÿåò êîíöåâûå ïðîáåëû è óïðàâëÿþùèå ñèìâîëû èç
ñòðîêè S. Ïðè ýòîì èñõîäíàÿ ñòðîêà èçìåíÿåòñÿ. Ýòà ïðîöåäóðà ðàáîòàåò
áûñòðåå, ÷åì ñòàíäàðòíàÿ ôóíêöèÿ TrimRight. }
procedure Q_TrimRightInPlace(var S: string);
{ Q_TrimChar óäàëÿåò âåäóùèå è êîíöåâûå ñèìâîëû Ch èç ñòðîêè S. Èñõîäíàÿ
ñòðîêà S íå èçìåíÿåòñÿ. }
function Q_TrimChar(const S: string; Ch: Char = ' '): string;
{ Q_TrimCharLeft óäàëÿåò âåäóùèå ñèìâîëû Ch èç ñòðîêè S. Èñõîäíàÿ ñòðîêà S
íå èçìåíÿåòñÿ.}
function Q_TrimCharLeft(const S: string; Ch: Char = ' '): string;
{ Q_TrimCharRight óäàëÿåò êîíöåâûå ñèìâîëû Ch èç ñòðîêè S. Èñõîäíàÿ ñòðîêà S
íå èçìåíÿåòñÿ.}
function Q_TrimCharRight(const S: string; Ch: Char = ' '): string;
{ Q_KeepOneChar óäàëÿåò âñå ïîäðÿä èäóùèå ñèìâîëû Ch, êðîìå îäíîãî, èç ñòðîêè,
ïåðåäàííîé ïàðàìåòðîì S. Èñõîäíàÿ ñòðîêà ïðè ýòîì íå èçìåíÿåòñÿ. Íàïðèìåð,
Q_KeepOneChar('How do you do ',' ') âåðíåò ñòðîêó 'How do you do '. }
function Q_KeepOneChar(const S: string; Ch: Char = ' '): string;
{ Q_SpaceCompressInPlace óäàëÿåò èç ñòðîêè íà÷àëüíûå è êîíå÷íûå ïðîáåëû è
óïðàâëÿþùèå ñèìâîëû (ìåíüøå ïðîáåëà). Êðîìå òîãî, âñå ïîäðÿä èäóùèå ïðîáåëû
è óïðàâëÿþùèå ñèìâîëû â ñåðåäèíå ñòðîêè çàìåíÿþòñÿ îäíèì ïðîáåëîì. Èñõîäíàÿ
ñòðîêà èçìåíÿåòñÿ. }
procedure Q_SpaceCompressInPlace(var S: string);
{ Q_SpaceCompress óäàëÿåò èç ñòðîêè íà÷àëüíûå è êîíå÷íûå ïðîáåëû è óïðàâëÿþùèå
ñèìâîëû (ìåíüøå ïðîáåëà). Êðîìå òîãî, âñå ïîäðÿä èäóùèå ïðîáåëû è óïðàâëÿþùèå
ñèìâîëû â ñåðåäèíå ñòðîêè çàìåíÿþòñÿ îäíèì ïðîáåëîì. Èñõîäíàÿ ñòðîêà ïðè ýòîì
íå èçìåíÿåòñÿ. Ýòà ôóíêöèÿ ðàáîòàåò ìåäëåííåå, ÷åì Q_SpaceCompressInPlace. }
function Q_SpaceCompress(const S: string): string;
{ Q_PadLeft äîïîëíÿåò ñòðîêó S ñèìâîëàìè PadCh ñëåâà äî äëèíû Length. Åñëè
äëèíà ñòðîêè S áîëüøå Length, òî, åñëè ïàðàìåòð Cut = True, ñòðîêà îáðåçàåòñÿ
ñïðàâà äî äëèíû Length, èíà÷å (Cut = False) âîçâðàùàåòñÿ èñõîäíàÿ ñòðîêà S. }
function Q_PadLeft(const S: string; Length: Integer; PadCh: Char = ' ';
Cut: Boolean = False): string;
{ Q_PadRight äîïîëíÿåò ñòðîêó S ñèìâîëàìè PadCh ñïðàâà äî äëèíû Length. Åñëè
äëèíà ñòðîêè S áîëüøå Length, òî, åñëè ïàðàìåòð Cut = True, ñòðîêà îáðåçàåòñÿ
ñïðàâà äî äëèíû Length, èíà÷å (Cut = False) âîçâðàùàåòñÿ èñõîäíàÿ ñòðîêà S. }
function Q_PadRight(const S: string; Length: Integer; PadCh: Char = ' ';
Cut: Boolean = False): string;
{ Q_CenterStr öåíòðèðóåò ñòðîêó S ñèìâîëàìè PadCh îòíîñèòåëüíî äëèíû Length.
Åñëè äëèíà ñòðîêè S áîëüøå Length, òî, åñëè ïàðàìåòð Cut = True, ñòðîêà
îáðåçàåòñÿ ñïðàâà äî äëèíû Length, èíà÷å (Cut = False) âîçâðàùàåòñÿ èñõîäíàÿ
ñòðîêà S. }
function Q_CenterStr(const S: string; Length: Integer; PadCh: Char = ' ';
Cut: Boolean = False): string;
{ Q_PadInside äîáàâëÿåò (ðàâíîìåðíî) ñèìâîëû PadCh â ñòðîêó S â òåõ ïîçèöèÿõ,
ãäå îíè óæå ïðèñóòñòâóþò, äî òåõ ïîð, ïîêà äëèíà ñòðîêè íå ñòàíåò ðàâíîé
Length. Äðóãèìè ñëîâàìè, ýòà ôóíêöèÿ ïðîèçâîäèò âûðàâíèâàíèå òåêñòà ïî îáîèì
êðàÿì. Åñëè äëèíà ñòðîêè ïðåâûøàåò Length, òî, åñëè ïàðàìåòð Cut = True,
ñòðîêà îáðåçàåòñÿ ñïðàâà äî äëèíû Length, èíà÷å (Cut = False) âîçâðàùàåòñÿ
èñõîäíàÿ ñòðîêà S. Íèêàêèå ñïåöèàëüíûå ñèìâîëû íå ðàñïîçíàþòñÿ. }
function Q_PadInside(const S: string; Length: Integer; PadCh: Char = ' ';
Cut: Boolean = False): string;
{ Q_TabsToSpaces çàìåíÿåò âñå ñèìâîëû òàáóëÿöèè (#9) â ñòðîêå S ïðîáåëàìè.
Èíòåðâàë òàáóëÿöèè çàäàåòñÿ ïàðàìåòðîì TabStop. }
function Q_TabsToSpaces(const S: string; TabStop: Integer = 8): string;
{ Q_SpacesToTabs çàìåíÿåò ïîñëåäîâàòåëüíîñòè ïðîáåëîâ â ñòðîêå S ñèìâîëàìè
òàáóëÿöèè #9. Èíòåðâàë òàáóëÿöèè çàäàåòñÿ ïàðàìåòðîì TabStop. Ýòà ôóíêöèÿ
ðàáîòàåò, äàæå, åñëè èñõîäíàÿ ñòðîêà óæå ñîäåðæèò ñèìâîëû òàáóëÿöèè. }
function Q_SpacesToTabs(const S: string; TabStop: Integer = 8): string;
{ Q_StrTok âîçâðàùàåò î÷åðåäíîé ôðàãìåíò ñòðîêè S, îäíîâðåìåííî óäàëÿÿ åãî èç
èñõîäíîé ñòðîêè. Q_StrTok ðàññìàòðèâàåò ñòðîêó S êàê ïîñëåäîâàòåëüíîñòü èç
íóëÿ èëè áîëåå òåêñòîâûõ ôðàãìåíòîâ, îòäåëåííûõ äðóã îò äðóãà îäíèì èëè áîëåå
ñèìâîëîì-ðàçäåëèòåëåì èç ñòðîêè Delimiters. Â ïàðàìåòðå Delimiters ïåðåäàåòñÿ
ñòðîêà, êîòîðàÿ ñîñòîèò èç ñèìâîëîâ, êîòîðûå ðàññìàòðèâàþòñÿ êàê ðàçäåëèòåëè
äëÿ ñòðîêè S. Ñàìè ðàçäåëèòåëè íå âêëþ÷àþòñÿ âî ôðàãìåíò, âîçâðàùàåìûé
ôóíêöèåé Q_StrTok. Åñëè ñòðîêà íà÷èíàåòñÿ ñ ñèìâîëîâ-ðàçäåëèòåëåé, òî âñå
îíè óäàëÿþòñÿ. Åñëè Delimiters - ïóñòàÿ ñòðîêå, èñïîëüçóþòñÿ ðàçäåëèòåëè,
êîòîðûå áûëè çàäàíû â õîäå ïðåäûäóùåãî âûçîâà îäíîé èç ñëåäóþùèõ ôóíêöèé:
Q_StrTok, Q_StrSpn, Q_StrCSpn, Q_ProperCase, Q_WordAtPos, Q_SetDelimiters,
Q_GetWordN, Q_ProperCaseInPlace, Q_CountOfWords. Åñëè ðàçäåëèòåëè ïåðåäàþòñÿ
â âèäå ìíîæåñòâà, îíè íå çàïîìèíàþòñÿ äëÿ ïîñëåäóþùèõ âûçîâîâ ôóíêöèé. }
function Q_StrTok(var S: string; const Delimiters: string): string; overload;
function Q_StrTok(var S: string;
const Delimiters: TCharSet = Q_SP): string; overload;
{ Q_StrTok1 âîçâðàùàåò î÷åðåäíîé ôðàãìåíò ñòðîêè S, îäíîâðåìåííî óäàëÿÿ åãî
èç èñõîäíîé ñòðîêè è óäàëÿÿ ñëåäóþùèé çà íèì ñèìâîë-ðàçäåëèòåëü. Q_StrTok1
ðàññìàòðèâàåò ñòðîêó S êàê ïîñëåäîâàòåëüíîñòü èç íóëÿ èëè áîëåå òåêñòîâûõ
ôðàãìåíòîâ, îòäåëåííûõ äðóã îò äðóãà åäèíè÷íûì ñèìâîëîì-ðàçäåëèòåëåì èç
ñòðîêè Delimiters. Åñëè â ñòðîêå S ïîäðÿä èäåò íåñêîëüêî ðàçäåëèòåëåé, òî
ôóíêöèÿ áóäåò âîçâðàùàòü ïóñòóþ ñòðîêó äëÿ êàæäîãî òàêîãî ñèìâîëà, åñëè
ïåðåä íèì îòñóòñòâóåò òåêñòîâûé ôðàãìåíò. Â ïàðàìåòðå Delimiters ïåðåäàåòñÿ
ñòðîêà, êîòîðàÿ ñîñòîèò èç ñèìâîëîâ, êîòîðûå ðàññìàòðèâàþòñÿ êàê ðàçäåëèòåëè
äëÿ ñòðîêè S. Ñàìè ðàçäåëèòåëè íå âêëþ÷àþòñÿ âî ôðàãìåíò, âîçâðàùàåìûé
ôóíêöèåé Q_StrTok1. Åñëè Delimiters - ïóñòàÿ ñòðîêå, èñïîëüçóþòñÿ ñèìâîëû,
êîòîðûå áûëè çàäàíû â õîäå ïðåäûäóùåãî âûçîâà îäíîé èç ñëåäóþùèõ ôóíêöèé:
Q_StrTok, Q_StrSpn, Q_StrCSpn, Q_ProperCase, Q_WordAtPos, Q_SetDelimiters,
Q_GetWordN, Q_ProperCaseInPlace, Q_CountOfWords. Åñëè ðàçäåëèòåëè ïåðåäàþòñÿ
â âèäå ìíîæåñòâà, îíè íå çàïîìèíàþòñÿ äëÿ ïîñëåäóþùèõ âûçîâîâ ôóíêöèé. }
function Q_StrTok1(var S: string; const Delimiters: string): string; overload;
function Q_StrTok1(var S: string; const Delimiters: TCharSet = Q_SP): string; overload;
{ Q_WordAtPos âîçâðàùàåò ñëîâî èç ñòðîêè S, â ñîñòàâå êîòîðîãî íàõîäèòñÿ
ñèìâîë S[Pos]. Ñòðîêà Delimiters çàäàåò ñèìâîëû, ñ÷èòàþùèåñÿ ðàçäåëèòåëÿìè
ñëîâ â ñòðîêå S. Åñëè ñèìâîë â ïîçèöèè Pos ÿâëÿåòñÿ ðàçäåëèòåëåì, ôóíêöèÿ
âîçâðàùàåò ïóñòóþ ñòðîêó. Åñëè Delimiters ðàâíà ïóñòîé ñòðîêå, èñïîëüçóåòñÿ
ñïèñîê ðàçäåëèòåëåé, êîòîðûå áûëè çàäàíû â õîäå ïðåäûäóùåãî âûçîâà îäíîé èç
ñëåäóþùèõ ôóíêöèé: Q_StrTok, Q_StrSpn, Q_StrCSpn, Q_ProperCase, Q_WordAtPos,
Q_GetWordN, Q_ProperCaseInPlace, Q_SetDelimiters, Q_CountOfWords. Åñëè
ðàçäåëèòåëè ïåðåäàþòñÿ â âèäå ìíîæåñòâà òèïà TCharSet, îíè íå çàïîìèíàþòñÿ
äëÿ ïîñëåäóþùèõ âûçîâîâ ôóíêöèé. }
function Q_WordAtPos(const S: string; Pos: Integer; const Delimiters: string): string; overload;
function Q_WordAtPos(const S: string; Pos: Integer;
const Delimiters: TCharSet = Q_SP): string; overload;
{ Q_GetWordN âîçâðàùàåò ñëîâî ñ ïîðÿäêîâûì íîìåðîì OrdN èç ñòðîêè S. Ñëîâà
íóìåðóþòñÿ ñ åäèíèöû. Ñòðîêà Delimiters çàäàåò ñèìâîëû, ñ÷èòàþùèåñÿ ðàçäåëè-
òåëÿìè ñëîâ â ñòðîêå S. Åñëè ñëîâî ñ íîìåðîì OrdN â ñòðîêå S îòñóòñòâóåò,
âîçâðàùàåòñÿ ïóñòàÿ ñòðîêà. Åñëè Delimiters ðàâíà ïóñòîé ñòðîêå, èñïîëüçóåòñÿ
ñïèñîê ðàçäåëèòåëåé, êîòîðûå áûëè çàäàíû â õîäå ïðåäûäóùåãî âûçîâà îäíîé èç
ñëåäóþùèõ ôóíêöèé: Q_StrTok, Q_StrSpn, Q_StrCSpn, Q_ProperCase, Q_WordAtPos,
Q_GetWordN, Q_ProperCaseInPlace, Q_SetDelimiters, Q_CountOfWords. Åñëè
ðàçäåëèòåëè ïåðåäàþòñÿ â âèäå ìíîæåñòâà òèïà TCharSet, îíè íå çàïîìèíàþòñÿ
äëÿ ïîñëåäóþùèõ âûçîâîâ ôóíêöèé. }
function Q_GetWordN(OrdN: Integer; const S, Delimiters: string): string; overload;
function Q_GetWordN(OrdN: Integer; const S: string;
const Delimiters: TCharSet = Q_SP): string; overload;
{ Èäåÿ ñëåäóþùèõ ïÿòè ôóíêöèé ïîçàèìñòâîâàíà èç ìîäóëÿ cStrings.pas, àâòîðîì
êîòîðîãî ÿâëÿåòñÿ David Butler ([email protected]). }
{ Q_CopyRange âîçâðàùàåò ïîäñòðîêó èç ñòðîêè S, íà÷èíàÿ ñ ñèìâîëà, èíäåêñ
êîòîðîãî ðàâåí Start, è êîí÷àÿ ñèìâîëîì ñ èíäåêñîì Stop. }
function Q_CopyRange(const S: string; Start, Stop: Integer): string;
{ Q_CopyFrom âîçâðàùàåò ïîäñòðîêó èç ñòðîêè S, íà÷èíàÿ ñ ñèìâîëà, èíäåêñ
êîòîðîãî ðàâåí Start, è äî êîíöà ñòðîêè. }
function Q_CopyFrom(const S: string; Start: Integer): string;
{ Q_CopyLeft âîçâðàùàåò Count ïåðâûõ ñèìâîëîâ ñòðîêè, ïåðåäàííîé ïàðàìåòðîì S. }
function Q_CopyLeft(const S: string; Count: Integer): string;
{ Q_CopyRight âîçâðàùàåò Count ïîñëåäíèõ ñèìâîëîâ ñòðîêè, ïåðåäàííîé
ïàðàìåòðîì S. }
function Q_CopyRight(const S: string; Count: Integer): string;
{ Q_PasteStr çàìåíÿåò Count ñèìâîëîâ ñòðîêè Dest, íà÷èíàÿ ñ ïîçèöèè Pos, ñîäåð-
æèìûì ñòðîêè Source. Ñòðîêà Dest ïðè ýòîì èçìåíÿåòñÿ. Íàïðèìåð, åñëè ñòðîêà
Dest ðàâíà 'How do you do', òî ïîñëå âûïîëíåíèÿ ïðîöåäóðû: Q_PasteStr(Dest,
5,6,'does he'), îíà áóäåò ðàâíà 'How does he do'. Ýòà ïðîöåäóðà âûïîëíÿåòñÿ
áûñòðåå, ÷åì êîìáèíàöèÿ ñòàíäàðòíûõ Delete-Insert. }
procedure Q_PasteStr(var Dest: string; Pos, Count: Integer; const Source: string);
{ Q_CopyDel âîçâðàùàåò ïîäñòðîêó, îäíîâðåìåííî óäàëÿÿ åå èç èñõîäíîé ñòðîêè.
S - èñõîäíàÿ ñòðîêà, Start - íîìåð ïåðâîãî âûðåçàåìîãî ñèìâîëà, Len - äëèíà
âûðåçàåìîé ïîäñòðîêè. Ýòà ôóíêöèÿ ïîçàèìñòâîâàíà èç ìîäóëÿ AGSLib.pas,
àâòîðîì êîòîðîãî ÿâëÿåòñÿ Àëåêñåé Ëóêèí. }
function Q_CopyDel(var S: string; Start, Length: Integer): string;
{ Äðóãèå ôóíêöèè äëÿ ðàáîòû ñî ñòðîêàìè. }
{ Q_SetDelimiters çàäàåò ñòðîêó (èëè ìíîæåñòâî) ñèìâîëîâ-ðàçäåëèòåëåé ñëîâ
äëÿ ïîñëåäóþùåãî âûçîâà òàêèõ ôóíêöèé, êàê Q_StrTok, Q_StrSpn, Q_StrCSpn,
Q_ProperCase, Q_WordAtPos, Q_GetWordN, Q_ProperCaseInPlace, Q_CountOfWords.
 ýòîì ñëó÷àå àðãóìåíò Delimiters ïðè âûçîâå ýòèõ ôóíêöèé äîëæåí áûòü ðàâåí
ïóñòîé ñòðîêå. Åñëè ïðîöåäóðà Q_SetDelimiters âûçâàíà áåç ïàðàìåòðîâ, òî â
êà÷åñòâå ðàçäåëèòåëåé ïðèíèìàþòñÿ ñèìâîëû èç êîíñòàíòíîãî ìíîæåñòâà
Q_StdDelimsSet, îïðåäåëåííîãî â íà÷àëå ìîäóëÿ QStrings. }
procedure Q_SetDelimiters(const Delimiters: string); overload;
procedure Q_SetDelimiters(const Delimiters: TCharSet = Q_SP); overload;
{ Q_GetDelimiters âîçâðàùàåò ñòðîêó, ñîñòîÿùóþ èç ñèìâîëîâ-ðàçäåëèòåëåé ñëîâ,
ïåðå÷èñëåííûõ â ïîðÿäêå, ñîîòâåòñòâóþùèì èõ êîäàì. Åñëè ðàíåå íå âûçûâàëèñü
êàêèå-ëèáî ôóíêöèè, çàäàþùèå ñòðîêó ðàçäåëèòåëåé (íàïðèìåð Q_SetDelimiters),
ðåçóëüòàò ôóíêöèè Q_GetDelimiters áóäåò íåîïðåäåëåííûì. }
function Q_GetDelimiters: string;
{ Q_StrMoveL êîïèðóåò ñîäåðæèìîå ñòðîêè Source â ñòðîêó Dest. Ìàêñèìàëüíîå
÷èñëî êîïèðóåìûõ ñèìâîëîâ ðàâíî MaxL. Äëèíà ñòðîêè Dest óñòàíàâëèâàåòñÿ
ðàâíîé ÷èñëó ñêîïèðîâàííûõ ñèìâîëîâ. Ïàìÿòü äëÿ ñòðîêè Dest äîëæíà áûòü
ðàñïðåäåëåíà çàðàíåå âûçîâîì ôóíêöèè SetString (èëè SetLength) (ðàçìåðîì
íå ìåíåå MaxL ñèìâîëîâ). Q_StrMoveL ðàáîòàåò íàìíîãî áûñòðåå, ÷åì îáû÷íîå
ïðèñâîåíèå ñòðîêè, ïðè êîòîðîì ïðîèñõîäèò åå êîïèðîâàíèå. }
procedure Q_StrMoveL(const Source: string; var Dest: string; MaxL: Cardinal);
{ Q_StrReverse ïåðåâîðà÷èâàåò ñòðîêó S òàê, ÷òî ïåðâûé ñèìâîë ñòàíîâèòñÿ
ïîñëåäíèì, âòîðîé - ïðåäïîñëåäíèì è ò.ä. Ïðè ýòîì èçìåíÿåòñÿ èñõîäíàÿ
ñòðîêà. Ôóíêöèÿ Q_PStrReverse àíàëîãè÷íà Q_StrReverse äëÿ Pointer(String).
Êðîìå òîãî, îíà âîçâðàùàåò óêàçàòåëü íà íà÷àëî ñòðîêè. }
procedure Q_StrReverse(var S: string);
function Q_PStrReverse(P: Pointer): Pointer;
{ Q_CutLeft îáðåçàåò ñòðîêó S ñëåâà íà CharCount ñèìâîëîâ, óìåíüøàÿ ïðè ýòîì
åå äëèíó. Åñëè ïàðàìåòð CharCount îòðèöàòåëüíûé, ñòðîêà îáðåçàåòñÿ ñïðàâà. }
procedure Q_CutLeft(var S: string; CharCount: Integer);
{ Q_CutRight îáðåçàåò ñòðîêó S ñïðàâà íà CharCount ñèìâîëîâ, óìåíüøàÿ ïðè ýòîì
åå äëèíó. Åñëè ïàðàìåòð CharCount îòðèöàòåëüíûé, ñòðîêà îáðåçàåòñÿ ñëåâà. }
procedure Q_CutRight(var S: string; CharCount: Integer);
{ Q_RotateLeft öèêëè÷åñêè ñäâèãàåò ñòðîêó S íà Shift ñèìâîëîâ âëåâî. Ïàðàìåòð
Shift ìîæåò áûòü êàê ïîëîæèòåëüíûì, òàê è îòðèöàòåëüíûì. }
procedure Q_RotateLeft(var S: string; Shift: Integer);
{ Q_RotateRight öèêëè÷åñêè ñäâèãàåò ñòðîêó S íà Shift ñèìâîëîâ âïðàâî.
Ïàðàìåòð Shift ìîæåò áûòü êàê ïîëîæèòåëüíûì, òàê è îòðèöàòåëüíûì. }
procedure Q_RotateRight(var S: string; Shift: Integer);
{ Q_Duplicate âîçâðàùàåò ñòðîêó, ñîñòîÿùóþ èç Count êîïèé ñòðîêè S. }
function Q_Duplicate(const S: string; Count: Integer): string;
{ Q_Base64Encode âîçâðàùàåò ñòðîêó S èëè áàéòîâûé ìàññèâ, àäðåñóåìûé ïàðàìåòðîì
P, äëèíîé L áàéò, çàêîäèðîâàííûå â ôîðìàòå Base64 (MIME), ÷àñòî èñïîëüçóåìîì
ïðè ïåðåñûëêå ôàéëîâ ïî ýëåêòðîííîé ïî÷òå. Ðåçóëüòèðóþùàÿ ñòðîêà äîïîëíÿåòñÿ
â êîíöå ñèìâîëàìè '=' äî äëèíû, êðàòíîé 4. ×òîáû èçáåæàòü äîïîëíåíèÿ, äëèíà
èñõîäíîé ñòðîêè èëè áàéòîâîãî ìàññèâà äîëæíà áûòü êðàòíîé 3. }
function Q_Base64Encode(const S: string): string; overload;
function Q_Base64Encode(P: Pointer; L: Cardinal): string; overload;
{ Q_Base64Decode âîçâðàùàåò ðåçóëüòàò ðàñêîäèðîâàíèÿ ñòðîêè S èç êîäèðîâêè
Base64, ò.å. âîññòàíàâëèâàåò ïåðâîíà÷àëüíîå ñîäåðæèìîå ñòðîêè. Äëèíà
çàêîäèðîâàííîé ñòðîêè äîëæíà áûòü êðàòíîé 4. }
function Q_Base64Decode(const S: string): string;