Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Compare() [3/7]

int System.Globalization.CompareInfo.Compare ( string? string1,
int offset1,
int length1,
string? string2,
int offset2,
int length2,
CompareOptions options )
inline

Definition at line 309 of file CompareInfo.cs.

310 {
313 if (string1 == null)
314 {
315 if (offset1 == 0 && length1 == 0)
316 {
317 goto IL_0027;
318 }
319 }
320 else if (string1.TryGetSpan(offset1, length1, out slice))
321 {
322 goto IL_0027;
323 }
324 goto IL_006e;
325 IL_0044:
326 int result;
327 if (string1 == null)
328 {
329 result = ((string2 != null) ? (-1) : 0);
330 }
331 else
332 {
333 if (string2 != null)
334 {
335 return Compare(slice, slice2, options);
336 }
337 result = 1;
338 }
340 return result;
341 IL_0027:
342 if (string2 == null)
343 {
344 if (offset2 == 0 && length2 == 0)
345 {
346 goto IL_0044;
347 }
348 }
349 else if (string2.TryGetSpan(offset2, length2, out slice2))
350 {
351 goto IL_0044;
352 }
353 goto IL_006e;
354 IL_006e:
355 if (length1 < 0 || length2 < 0)
356 {
357 throw new ArgumentOutOfRangeException((length1 < 0) ? "length1" : "length2", SR.ArgumentOutOfRange_NeedPosNum);
358 }
359 if (offset1 < 0 || offset2 < 0)
360 {
361 throw new ArgumentOutOfRangeException((offset1 < 0) ? "offset1" : "offset2", SR.ArgumentOutOfRange_NeedPosNum);
362 }
363 if (offset1 > (string1?.Length ?? 0) - length1)
364 {
365 throw new ArgumentOutOfRangeException("string1", SR.ArgumentOutOfRange_OffsetLength);
366 }
367 throw new ArgumentOutOfRangeException("string2", SR.ArgumentOutOfRange_OffsetLength);
368 }
static void CheckCompareOptionsForCompare(CompareOptions options)
int Compare(string? string1, string? string2)

References System.SR.ArgumentOutOfRange_NeedPosNum, System.SR.ArgumentOutOfRange_OffsetLength, System.Globalization.CompareInfo.CheckCompareOptionsForCompare(), System.Globalization.CompareInfo.Compare(), System.Runtime.Serialization.Dictionary, System.length1, System.length2, and System.options.