forked from PeterWaher/IoTGateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCaseInsensitiveString.cs
More file actions
2714 lines (2555 loc) · 102 KB
/
Copy pathCaseInsensitiveString.cs
File metadata and controls
2714 lines (2555 loc) · 102 KB
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
using System;
using System.Collections.Generic;
using System.Text;
namespace Waher.Persistence
{
/// <summary>
/// Represents a case-insensitive string.
/// </summary>
public class CaseInsensitiveString : IComparable<CaseInsensitiveString>, IComparable
{
private readonly string value;
private readonly string lowerCase;
/// <summary>
/// Represents a case-insensitive string.
/// </summary>
/// <param name="Value">Value</param>
public CaseInsensitiveString(string Value)
{
this.value = Value;
this.lowerCase = Value?.ToLower();
}
/// <summary>
/// String-representation of the case-insensitive string. (Representation is case sensitive.)
/// </summary>
public string Value => this?.value;
/// <summary>
/// Lower-case representation of the case-insensitive string.
/// </summary>
public string LowerCase => this?.lowerCase;
/// <summary>
/// <see cref="Object.ToString"/>
/// </summary>
public override string ToString()
{
return this.value ?? string.Empty;
}
/// <summary>
/// Returns the hash code for this string.
/// </summary>
/// <returns>A 32-bit signed integer hash code.</returns>
public override int GetHashCode()
{
return this.lowerCase?.GetHashCode() ?? 0;
}
/// <summary>
/// Determines whether this instance and a specified object, which must also be a
/// System.CaseInsensitiveString object, have the same value.
/// </summary>
/// <param name="obj">The string to compare to this instance.</param>
/// <returns>
/// true if obj is a System.CaseInsensitiveString and its value is the same as this instance; otherwise,
/// false. If obj is null, the method returns false.
/// </returns>
public override bool Equals(object obj)
{
if (obj is CaseInsensitiveString S)
return this.lowerCase?.Equals(S.lowerCase) ?? (S.lowerCase is null);
else if (obj is string S2)
return this.lowerCase?.Equals(S2?.ToLower()) ?? (S2 is null);
else
return false;
}
/// <summary>
/// Compares this instance with a specified System.CaseInsensitiveString object and indicates whether
/// this instance precedes, follows, or appears in the same position in the sort
/// order as the specified string.
/// </summary>
/// <param name="other">The string to compare with this instance.</param>
/// <returns>
/// A 32-bit signed integer that indicates whether this instance precedes, follows,
/// or appears in the same position in the sort order as the strB parameter.Value
/// Condition Less than zero This instance precedes strB. Zero This instance has
/// the same position in the sort order as strB. Greater than zero This instance
/// follows strB.-or- strB is null.
/// </returns>
public int CompareTo(CaseInsensitiveString other)
{
return this.lowerCase.CompareTo(other.lowerCase);
}
/// <summary>
/// Compares this instance with a specified System.CaseInsensitiveString object and indicates whether
/// this instance precedes, follows, or appears in the same position in the sort
/// order as the specified string.
/// </summary>
/// <param name="obj">The string to compare with this instance.</param>
/// <returns>
/// A 32-bit signed integer that indicates whether this instance precedes, follows,
/// or appears in the same position in the sort order as the strB parameter.Value
/// Condition Less than zero This instance precedes strB. Zero This instance has
/// the same position in the sort order as strB. Greater than zero This instance
/// follows strB.-or- strB is null.
/// </returns>
public int CompareTo(object obj)
{
if (obj is CaseInsensitiveString S)
return this.lowerCase.CompareTo(S.lowerCase);
else if (obj is string S2)
return this.lowerCase.CompareTo(S2.ToLower());
else
return -1;
}
/// <summary>
/// Implicitly cases a case-insensitive string to a case-sensitive string.
/// </summary>
/// <param name="S">Case-insensitive string</param>
/// <returns>Case-sensitive string.</returns>
public static implicit operator string(CaseInsensitiveString S)
{
return S?.value;
}
/// <summary>
/// Implicitly cases a case-sensitive string to a case-insensitive string.
/// </summary>
/// <param name="S">Case-sensitive string</param>
/// <returns>Case-insensitive string.</returns>
public static implicit operator CaseInsensitiveString(string S)
{
return new CaseInsensitiveString(S);
}
/// <summary>
/// Equality operator
/// </summary>
public static bool operator ==(CaseInsensitiveString S1, CaseInsensitiveString S2)
{
return S1?.lowerCase == S2?.lowerCase;
}
/// <summary>
/// Non-Equality operator
/// </summary>
public static bool operator !=(CaseInsensitiveString S1, CaseInsensitiveString S2)
{
return S1?.lowerCase != S2?.lowerCase;
}
/// <summary>
/// Lesser-than operator
/// </summary>
public static bool operator <(CaseInsensitiveString S1, CaseInsensitiveString S2)
{
return string.Compare(S1.lowerCase, S2.lowerCase) < 0;
}
/// <summary>
/// Greater-than operator
/// </summary>
public static bool operator >(CaseInsensitiveString S1, CaseInsensitiveString S2)
{
return string.Compare(S1.lowerCase, S2.lowerCase) > 0;
}
/// <summary>
/// Lesser-than-or-equal-to operator
/// </summary>
public static bool operator <=(CaseInsensitiveString S1, CaseInsensitiveString S2)
{
return string.Compare(S1.lowerCase, S2.lowerCase) <= 0;
}
/// <summary>
/// Greater-than-or-equal-to operator
/// </summary>
public static bool operator >=(CaseInsensitiveString S1, CaseInsensitiveString S2)
{
return string.Compare(S1.lowerCase, S2.lowerCase) >= 0;
}
/// <summary>
/// Equality operator
/// </summary>
public static bool operator ==(CaseInsensitiveString S1, string S2)
{
return S1.lowerCase == S2.ToLower();
}
/// <summary>
/// Non-Equality operator
/// </summary>
public static bool operator !=(CaseInsensitiveString S1, string S2)
{
return S1.lowerCase != S2.ToLower();
}
/// <summary>
/// Lesser-than operator
/// </summary>
public static bool operator <(CaseInsensitiveString S1, string S2)
{
return string.Compare(S1.lowerCase, S2.ToLower()) < 0;
}
/// <summary>
/// Greater-than operator
/// </summary>
public static bool operator >(CaseInsensitiveString S1, string S2)
{
return string.Compare(S1.lowerCase, S2.ToLower()) > 0;
}
/// <summary>
/// Lesser-than-or-equal-to operator
/// </summary>
public static bool operator <=(CaseInsensitiveString S1, string S2)
{
return string.Compare(S1.lowerCase, S2.ToLower()) <= 0;
}
/// <summary>
/// Greater-than-or-equal-to operator
/// </summary>
public static bool operator >=(CaseInsensitiveString S1, string S2)
{
return string.Compare(S1.lowerCase, S2.ToLower()) >= 0;
}
/// <summary>
/// Equality operator
/// </summary>
public static bool operator ==(string S1, CaseInsensitiveString S2)
{
return S1.ToLower() == S2.lowerCase;
}
/// <summary>
/// Non-Equality operator
/// </summary>
public static bool operator !=(string S1, CaseInsensitiveString S2)
{
return S1.ToLower() != S2.lowerCase;
}
/// <summary>
/// Lesser-than operator
/// </summary>
public static bool operator <(string S1, CaseInsensitiveString S2)
{
return string.Compare(S1.ToLower(), S2.lowerCase) < 0;
}
/// <summary>
/// Greater-than operator
/// </summary>
public static bool operator >(string S1, CaseInsensitiveString S2)
{
return string.Compare(S1.ToLower(), S2.lowerCase) > 0;
}
/// <summary>
/// Lesser-than-or-equal-to operator
/// </summary>
public static bool operator <=(string S1, CaseInsensitiveString S2)
{
return string.Compare(S1.ToLower(), S2.lowerCase) <= 0;
}
/// <summary>
/// Greater-than-or-equal-to operator
/// </summary>
public static bool operator >=(string S1, CaseInsensitiveString S2)
{
return string.Compare(S1.ToLower(), S2.lowerCase) >= 0;
}
/// <summary>
/// Addition operator
/// </summary>
public static CaseInsensitiveString operator +(CaseInsensitiveString S1, CaseInsensitiveString S2)
{
return new CaseInsensitiveString(S1.value + S2.value);
}
/// <summary>
/// Addition operator
/// </summary>
public static string operator +(CaseInsensitiveString S1, string S2)
{
return S1?.value + S2;
}
/// <summary>
/// Addition operator
/// </summary>
public static string operator +(string S1, CaseInsensitiveString S2)
{
return S1 + S2.value;
}
/// <summary>
/// Empty case-insensitive string
/// </summary>
public static readonly CaseInsensitiveString Empty = new CaseInsensitiveString(string.Empty);
/// <summary>
/// Initializes a new instance of the <see cref="CaseInsensitiveString"/> class to the value indicated
/// by an array of Unicode characters.
/// </summary>
/// <param name="value">An array of Unicode characters.</param>
public CaseInsensitiveString(char[] value)
: this(new string(value))
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CaseInsensitiveString"/> class to the value indicated
/// by a specified Unicode character repeated a specified number of times.
/// </summary>
/// <param name="c">A Unicode character.</param>
/// <param name="count">The number of times c occurs.</param>
/// <exception cref="System.ArgumentOutOfRangeException">
/// count is less than zero.
/// </exception>
public CaseInsensitiveString(char c, int count)
: this(new string(c, count))
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CaseInsensitiveString"/> class to the value indicated
/// by an array of Unicode characters, a starting character position within that
/// array, and a length.
/// </summary>
/// <param name="value">An array of Unicode characters.</param>
/// <param name="startIndex">The starting position within value.</param>
/// <param name="length">The number of characters within value to use.</param>
/// <exception cref="System.ArgumentNullException">
/// value is null.
/// </exception>
/// <exception cref="System.ArgumentOutOfRangeException">
/// startIndex or length is less than zero.-or- The sum of startIndex and length
/// is greater than the number of elements in value.
/// </exception>
public CaseInsensitiveString(char[] value, int startIndex, int length)
: this(new string(value, startIndex, length))
{
}
/// <summary>
/// Gets the System.Char object at a specified position in the current <see cref="CaseInsensitiveString"/>
/// object.
/// </summary>
/// <param name="index">A position in the current string.</param>
/// <returns>
/// The object at position index.
/// </returns>
/// <exception cref="System.IndexOutOfRangeException">
/// index is greater than or equal to the length of this object or less than zero.
/// </exception>
public char this[int index] => this.value[index];
/// <summary>
/// Gets the number of characters in the current <see cref="CaseInsensitiveString"/> object.
/// </summary>
/// <returns>
/// The number of characters in the current string.
/// </returns>
public int Length => this.value.Length;
//
/// <summary>
/// Compares two specified <see cref="CaseInsensitiveString"/> objects and returns an integer that indicates
/// their relative position in the sort order.
/// </summary>
/// <param name="strA">The first string to compare.</param>
/// <param name="strB">The second string to compare.</param>
/// <returns>
/// A 32-bit signed integer that indicates the lexical relationship between the two
/// comparands.Value Condition Less than zero strA precedes strB in the sort order.
/// Zero strA occurs in the same position as strB in the sort order. Greater than
/// zero strA follows strB in the sort order.
/// </returns>
public static int Compare(CaseInsensitiveString strA, CaseInsensitiveString strB)
{
return string.Compare(strA.lowerCase, strB.lowerCase);
}
/// <summary>
/// Compares substrings of two specified <see cref="CaseInsensitiveString"/> objects using the specified
/// rules, and returns an integer that indicates their relative position in the sort
/// order.
/// </summary>
/// <param name="strA">The first string to use in the comparison.</param>
/// <param name="indexA">The position of the substring within strA.</param>
/// <param name="strB">The second string to use in the comparison.</param>
/// <param name="indexB">The position of the substring within strB.</param>
/// <param name="length">The maximum number of characters in the substrings to compare.</param>
/// <param name="comparisonType">One of the enumeration values that specifies the rules to use in the comparison.</param>
/// <returns>
/// A 32-bit signed integer that indicates the lexical relationship between the two
/// comparands.Value Condition Less than zero The substring in strA precedes the
/// substring in strB in the sort order.Zero The substrings occur in the same position
/// in the sort order, or the length parameter is zero. Greater than zero The substring
/// in strA follllows the substring in strB in the sort order.
/// </returns>
/// <exception cref="System.ArgumentOutOfRangeException">
/// indexA is greater than strA.<see cref="CaseInsensitiveString"/>.Length.-or- indexB is greater than
/// strB.<see cref="CaseInsensitiveString"/>.Length.-or- indexA, indexB, or length is negative. -or-Either
/// indexA or indexB is null, and length is greater than zero.
/// </exception>
/// <exception cref="System.ArgumentException">
/// comparisonType is not a StringComparison value.
/// </exception>
public static int Compare(CaseInsensitiveString strA, int indexA, CaseInsensitiveString strB, int indexB, int length, StringComparison comparisonType)
{
return string.Compare(strA.lowerCase, indexA, strB.lowerCase, indexB, length, comparisonType);
}
/// <summary>
/// Compares substrings of two specified <see cref="CaseInsensitiveString"/> objects and returns an integer
/// that indicates their relative position in the sort order.
/// </summary>
/// <param name="strA">
/// The first string to use in the comparison.
/// </param>
/// <param name="indexA">
/// The position of the substring within strA.
/// </param>
/// <param name="strB">
/// The second string to use in the comparison.
/// </param>
/// <param name="indexB">
/// The position of the substring within strB.
/// </param>
/// <param name="length">
/// The maximum number of characters in the substrings to compare.
/// </param>
/// <returns>
/// A 32-bit signed integer indicating the lexical relationship between the two comparands.Value
/// Condition Less than zero The substring in strA precedes the substring in strB
/// in the sort order. Zero The substrings occur in the same position in the sort
/// order, or length is zero. Greater than zero The substring in strA follows the
/// substring in strB in the sort order.
/// </returns>
/// <exception cref="System.ArgumentOutOfRangeException">
/// indexA is greater than strA.<see cref="CaseInsensitiveString"/>.Length.-or- indexB is greater than
/// strB.<see cref="CaseInsensitiveString"/>.Length.-or- indexA, indexB, or length is negative. -or-Either
/// indexA or indexB is null, and length is greater than zero.
/// </exception>
public static int Compare(CaseInsensitiveString strA, int indexA, CaseInsensitiveString strB, int indexB, int length)
{
return string.Compare(strA.lowerCase, indexA, strB.lowerCase, indexB, length);
}
//
/// <summary>
/// Compares two specified <see cref="CaseInsensitiveString"/> objects using the specified rules, and returns
/// an integer that indicates their relative position in the sort order.
/// </summary>
/// <param name="strA">
/// The first string to compare.
/// </param>
/// <param name="strB">
/// The second string to compare.
/// </param>
/// <param name="comparisonType">
/// One of the enumeration values that specifies the rules to use in the comparison.
/// </param>
/// <returns>
/// A 32-bit signed integer that indicates the lexical relationship between the two
/// comparands.Value Condition Less than zero strA precedes strB in the sort order.
/// Zero strA is in the same position as strB in the sort order. Greater than zero
/// strA follows strB in the sort order.
/// </returns>
/// <exception cref="System.ArgumentException">
/// comparisonType is not a <see cref="CaseInsensitiveString"/>Comparison value.
/// </exception>
/// <exception cref="System.NotSupportedException">
/// <see cref="CaseInsensitiveString"/>Comparison is not supported.
/// </exception>
public static int Compare(CaseInsensitiveString strA, CaseInsensitiveString strB, StringComparison comparisonType)
{
return string.Compare(strA.lowerCase, strB.lowerCase, comparisonType);
}
//
/// <summary>
/// Compares substrings of two specified <see cref="CaseInsensitiveString"/> objects by evaluating the
/// numeric values of the corresponding System.Char objects in each substring.
/// </summary>
/// <param name="strA">
/// The first string to use in the comparison.
/// </param>
/// <param name="indexA">
/// The starting index of the substring in strA.
/// </param>
/// <param name="strB">
/// The second string to use in the comparison.
/// </param>
/// <param name="indexB">
/// The starting index of the substring in strB.
/// </param>
/// <param name="length">
/// The maximum number of characters in the substrings to compare.
/// </param>
/// <returns>
/// A 32-bit signed integer that indicates the lexical relationship between the two
/// comparands.ValueCondition Less than zero The substring in strA is less than the
/// substring in strB. Zero The substrings are equal, or length is zero. Greater
/// than zero The substring in strA is greater than the substring in strB.
/// </returns>
/// <exception cref="System.ArgumentOutOfRangeException">
/// strA is not null and indexA is greater than strA.<see cref="CaseInsensitiveString"/>.Length.-or- strB
/// is not null andindexB is greater than strB.<see cref="CaseInsensitiveString"/>.Length.-or- indexA,
/// indexB, or length is negative.
/// </exception>
public static int CompareOrdinal(CaseInsensitiveString strA, int indexA, CaseInsensitiveString strB, int indexB, int length)
{
return string.CompareOrdinal(strA.lowerCase, indexA, strB.lowerCase, indexB, length);
}
//
/// <summary>
/// Compares two specified <see cref="CaseInsensitiveString"/> objects by evaluating the numeric values
/// of the corresponding System.Char objects in each string.
/// </summary>
/// <param name="strA">
/// The first string to compare.
/// </param>
/// <param name="strB">
/// The second string to compare.
/// </param>
/// <returns>
/// An integer that indicates the lexical relationship between the two comparands.ValueCondition
/// Less than zero strA is less than strB. Zero strA and strB are equal. Greater
/// than zero strA is greater than strB.
/// </returns>
public static int CompareOrdinal(CaseInsensitiveString strA, CaseInsensitiveString strB)
{
return string.CompareOrdinal(strA.lowerCase, strB.lowerCase);
}
//
/// <summary>
/// Concatenates the members of an System.Collections.Generic.IEnumerable`1 implementation.
/// </summary>
/// <param name="values">
/// A collection object that implements the System.Collections.Generic.IEnumerable`1
/// interface.
/// </param>
/// <typeparam name="T">
/// The type of the members of values.
/// </typeparam>
/// <returns>
/// The concatenated members in values.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// values is null.
/// </exception>
public static CaseInsensitiveString Concat<T>(IEnumerable<T> values)
{
return new CaseInsensitiveString(string.Concat<T>(values));
}
/// <summary>
/// Concatenates the elements of a specified <see cref="CaseInsensitiveString"/> array.
/// </summary>
/// <param name="values">
/// An array of string instances.
/// </param>
/// <returns>
/// The concatenated elements of values.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// values is null.
/// </exception>
/// <exception cref="System.OutOfMemoryException">
/// Out of memory.
/// </exception>
public static CaseInsensitiveString Concat(params CaseInsensitiveString[] values)
{
return new CaseInsensitiveString(string.Concat<CaseInsensitiveString>(values));
}
/// <summary>
/// Concatenates two specified instances of <see cref="CaseInsensitiveString"/>.
/// </summary>
/// <param name="str0">
/// The first string to concatenate.
/// </param>
/// <param name="str1">
/// The second string to concatenate.
/// </param>
/// <returns>
/// The concatenation of str0 and str1.
/// </returns>
public static CaseInsensitiveString Concat(CaseInsensitiveString str0, CaseInsensitiveString str1)
{
return new CaseInsensitiveString(string.Concat(str0.value, str1.value));
}
/// <summary>
/// Concatenates four specified instances of <see cref="CaseInsensitiveString"/>.
/// </summary>
/// <param name="str0">
/// The first string to concatenate.
/// </param>
/// <param name="str1">
/// The second string to concatenate.
/// </param>
/// <param name="str2">
/// The third string to concatenate.
/// </param>
/// <param name="str3">
/// The fourth string to concatenate.
/// </param>
/// <returns>
/// The concatenation of str0, str1, str2, and str3.
/// </returns>
public static CaseInsensitiveString Concat(CaseInsensitiveString str0, CaseInsensitiveString str1, CaseInsensitiveString str2, CaseInsensitiveString str3)
{
return new CaseInsensitiveString(string.Concat(str0.value, str1.value, str2.value, str3.value));
}
/// <summary>
/// Concatenates the string representations of three specified objects.
/// </summary>
/// <param name="arg0">
/// The first object to concatenate.
/// </param>
/// <param name="arg1">
/// The second object to concatenate.
/// </param>
/// <param name="arg2">
/// The third object to concatenate.
/// </param>
/// <returns>
/// The concatenated string representations of the values of arg0, arg1, and arg2.
/// </returns>
public static CaseInsensitiveString Concat(object arg0, object arg1, object arg2)
{
return new CaseInsensitiveString(string.Concat(arg0, arg1, arg2));
}
/// <summary>
/// Concatenates the string representations of two specified objects.
/// </summary>
/// <param name="arg0">
/// The first object to concatenate.
/// </param>
/// <param name="arg1">
/// The second object to concatenate.
/// </param>
/// <returns>
/// The concatenated string representations of the values of arg0 and arg1.
/// </returns>
public static CaseInsensitiveString Concat(object arg0, object arg1)
{
return new CaseInsensitiveString(string.Concat(arg0, arg1));
}
/// <summary>
/// Creates the string representation of a specified object.
/// </summary>
/// <param name="arg0">
/// The object to represent, or null.
/// </param>
/// <returns>
/// The string representation of the value of arg0, or <see cref="CaseInsensitiveString.Empty"/> if arg0
/// is null.
/// </returns>
public static CaseInsensitiveString Concat(object arg0)
{
return new CaseInsensitiveString(string.Concat(arg0));
}
/// <summary>
/// Concatenates the members of a constructed System.Collections.Generic.IEnumerable`1
/// collection of type <see cref="CaseInsensitiveString"/>.
/// </summary>
/// <param name="values">
/// A collection object that implements System.Collections.Generic.IEnumerable`1
/// and whose generic type argument is <see cref="CaseInsensitiveString"/>.
/// </param>
/// <returns>
/// The concatenated strings in values.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// values is null.
/// </exception>
public static CaseInsensitiveString Concat(IEnumerable<CaseInsensitiveString> values)
{
return Concat<CaseInsensitiveString>(values);
}
/// <summary>
/// Concatenates the string representations of the elements in a specified System.Object
/// array.
/// </summary>
/// <param name="args">
/// An object array that contains the elements to concatenate.
/// </param>
/// <returns>
/// The concatenated string representations of the values of the elements in args.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// args is null.
/// </exception>
/// <exception cref="System.OutOfMemoryException">
/// Out of memory.
/// </exception>
public static CaseInsensitiveString Concat(params object[] args)
{
return new CaseInsensitiveString(string.Concat(args));
}
/// <summary>
/// Concatenates three specified instances of <see cref="CaseInsensitiveString"/>.
/// </summary>
/// <param name="str0">
/// The first string to concatenate.
/// </param>
/// <param name="str1">
/// The second string to concatenate.
/// </param>
/// <param name="str2">
/// The third string to concatenate.
/// </param>
/// <returns>
/// The concatenation of str0, str1, and str2.
/// </returns>
public static CaseInsensitiveString Concat(CaseInsensitiveString str0, CaseInsensitiveString str1, CaseInsensitiveString str2)
{
return new CaseInsensitiveString(string.Concat(str0.value, str1.value, str2.value));
}
/// <summary>
/// Determines whether two specified System.CaseInsensitiveString objects have the same value. A
/// parameter specifies the culture, case, and sort rules used in the comparison.
/// </summary>
/// <param name="a">
/// The first string to compare, or null.
/// </param>
/// <param name="b">
/// The second string to compare, or null.
/// </param>
/// <param name="comparisonType">
/// One of the enumeration values that specifies the rules for the comparison.
/// </param>
/// <returns>
/// true if the value of the a parameter is equal to the value of the b parameter;
/// otherwise, false.
/// </returns>
/// <exception cref="System.ArgumentException">
/// comparisonType is not a <see cref="CaseInsensitiveString"/>Comparison value.
/// </exception>
public static bool Equals(CaseInsensitiveString a, CaseInsensitiveString b, StringComparison comparisonType)
{
return string.Equals(a.lowerCase, b.lowerCase, comparisonType);
}
/// <summary>
/// Determines whether two specified System.CaseInsensitiveString objects have the same value.
/// </summary>
/// <param name="a">
/// The first string to compare, or null.
/// </param>
/// <param name="b">
/// The second string to compare, or null.
/// </param>
/// <returns>
/// true if the value of a is the same as the value of b; otherwise, false. If both
/// a and b are null, the method returns true.
/// </returns>
public static bool Equals(CaseInsensitiveString a, CaseInsensitiveString b)
{
return string.Equals(a.lowerCase, b.lowerCase);
}
/// <summary>
/// Replaces one or more format items in a specified string with the string representation
/// of a specified object.
/// </summary>
/// <param name="format">
/// A composite format string.
/// </param>
/// <param name="arg0">
/// The object to format.
/// </param>
/// <returns>
/// A copy of format in which any format items are replaced by the string representation
/// of arg0.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// format is null.
/// </exception>
/// <exception cref="System.FormatException">
/// The format item in format is invalid.-or- The index of a format item is not zero.
/// </exception>
public static CaseInsensitiveString Format(CaseInsensitiveString format, object arg0)
{
return new CaseInsensitiveString(string.Format(format.lowerCase, arg0));
}
/// <summary>
/// Replaces the format items in a specified string with the string representations
/// of corresponding objects in a specified array. A parameter supplies culture-specific
/// formatting information.
/// </summary>
/// <param name="provider">
/// An object that supplies culture-specific formatting information.
/// </param>
/// <param name="format">
/// A composite format string.
/// </param>
/// <param name="args">
/// An object array that contains zero or more objects to format.
/// </param>
/// <returns>
/// A copy of format in which the format items have been replaced by the string representation
/// of the corresponding objects in args.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// format or args is null.
/// </exception>
/// <exception cref="System.FormatException">
/// format is invalid.-or- The index of a format item is less than zero, or greater
/// than or equal to the length of the args array.
/// </exception>
public static CaseInsensitiveString Format(IFormatProvider provider, CaseInsensitiveString format, params object[] args)
{
return new CaseInsensitiveString(string.Format(provider, format.lowerCase, args));
}
/// <summary>
/// Replaces the format items in a specified string with the string representation
/// of three specified objects. An parameter supplies culture-specific formatting
/// information.
/// </summary>
/// <param name="provider">
/// An object that supplies culture-specific formatting information.
/// </param>
/// <param name="format">
/// A composite format string.
/// </param>
/// <param name="arg0">
/// The first object to format.
/// </param>
/// <param name="arg1">
/// The second object to format.
/// </param>
/// <param name="arg2">
/// The third object to format.
/// </param>
/// <returns>
/// A copy of format in which the format items have been replaced by the string representations
/// of arg0, arg1, and arg2.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// format, arg0, arg1, or arg2 is null.
/// </exception>
/// <exception cref="System.FormatException">
/// format is invalid.-or- The index of a format item is less than zero, or greater
/// than or equal to three.
/// </exception>
public static CaseInsensitiveString Format(IFormatProvider provider, CaseInsensitiveString format, object arg0, object arg1, object arg2)
{
return new CaseInsensitiveString(string.Format(provider, format.lowerCase, arg0, arg1, arg2));
}
/// <summary>
/// Replaces the format items in a specified string with the string representation
/// of two specified objects.
/// </summary>
/// <param name="format">
/// A composite format string.
/// </param>
/// <param name="arg0">
/// The first object to format.
/// </param>
/// <param name="arg1">
/// The second object to format.
/// </param>
/// <returns>
/// A copy of format in which format items are replaced by the string representations
/// of arg0 and arg1.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// format is null.
/// </exception>
/// <exception cref="System.FormatException">
/// format is invalid.-or- The index of a format item is not zero or one.
/// </exception>
public static CaseInsensitiveString Format(CaseInsensitiveString format, object arg0, object arg1)
{
return new CaseInsensitiveString(string.Format(format.lowerCase, arg0, arg1));
}
/// <summary>
/// Replaces the format items in a specified string with the string representation
/// of two specified objects. A parameter supplies culture-specific formatting information.
/// </summary>
/// <param name="provider">
/// An object that supplies culture-specific formatting information.
/// </param>
/// <param name="format">
/// A composite format string.
/// </param>
/// <param name="arg0">
/// The first object to format.
/// </param>
/// <param name="arg1">
/// The second object to format.
/// </param>
/// <returns>
/// A copy of format in which format items are replaced by the string representations
/// of arg0 and arg1.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// format, arg0, or arg1 is null.
/// </exception>
/// <exception cref="System.FormatException">
/// format is invalid.-or- The index of a format item is less than zero, or greater
/// than or equal to two.
/// </exception>
public static CaseInsensitiveString Format(IFormatProvider provider, CaseInsensitiveString format, object arg0, object arg1)
{
return new CaseInsensitiveString(string.Format(provider, format.lowerCase, arg0, arg1));
}
/// <summary>
/// Replaces the format item or items in a specified string with the string representation
/// of the corresponding object. A parameter supplies culture-specific formatting
/// information.
/// </summary>
/// <param name="provider">
/// An object that supplies culture-specific formatting information.
/// </param>
/// <param name="format">
/// A composite format string.
/// </param>
/// <param name="arg0">
/// The object to format.
/// </param>
/// <returns>
/// A copy of format in which the format item or items have been replaced by the
/// string representation of arg0.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// format or arg0 is null.
/// </exception>
/// <exception cref="System.FormatException">
/// format is invalid.-or- The index of a format item is less than zero, or greater
/// than or equal to one.
/// </exception>
public static CaseInsensitiveString Format(IFormatProvider provider, CaseInsensitiveString format, object arg0)
{
return new CaseInsensitiveString(string.Format(provider, format.lowerCase, arg0));
}
/// <summary>
/// Replaces the format item in a specified string with the string representation
/// of a corresponding object in a specified array.
/// </summary>
/// <param name="format">
/// A composite format string.
/// </param>
/// <param name="args">
/// An object array that contains zero or more objects to format.
/// </param>
/// <returns>
/// A copy of format in which the format items have been replaced by the string representation
/// of the corresponding objects in args.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// format or args is null.
/// </exception>
/// <exception cref="System.FormatException">
/// format is invalid.-or- The index of a format item is less than zero, or greater
/// than or equal to the length of the args array.
/// </exception>
public static CaseInsensitiveString Format(CaseInsensitiveString format, params object[] args)
{
return new CaseInsensitiveString(string.Format(format.lowerCase, args));
}
/// <summary>
/// Replaces the format items in a specified string with the string representation
/// of three specified objects.
/// </summary>
/// <param name="format">
/// A composite format string.
/// </param>
/// <param name="arg0">
/// The first object to format.
/// </param>
/// <param name="arg1">
/// The second object to format.
/// </param>
/// <param name="arg2">