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

◆ SubstringTrim() [4/4]

static string System.StringExtensions.SubstringTrim ( this string value,
int startIndex,
int length )
inlinestaticpackage

Definition at line 5 of file StringExtensions.cs.

6 {
7 if (length == 0)
8 {
9 return string.Empty;
10 }
11 int num = startIndex + length - 1;
12 while (startIndex <= num && char.IsWhiteSpace(value[startIndex]))
13 {
14 startIndex++;
15 }
16 while (num >= startIndex && char.IsWhiteSpace(value[num]))
17 {
18 num--;
19 }
20 int num2 = num - startIndex + 1;
21 if (num2 != 0)
22 {
23 if (num2 != value.Length)
24 {
25 return value.Substring(startIndex, num2);
26 }
27 return value;
28 }
29 return string.Empty;
30 }

References System.length, System.startIndex, and System.value.