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

◆ StripSpaces() [2/2]

static string System.Xml.XmlTextReaderImpl.StripSpaces ( string value)
inlinestaticpackage

Definition at line 8450 of file XmlTextReaderImpl.cs.

8451 {
8452 int length = value.Length;
8453 if (length <= 0)
8454 {
8455 return string.Empty;
8456 }
8457 int num = 0;
8459 while (value[num] == ' ')
8460 {
8461 num++;
8462 if (num == length)
8463 {
8464 return " ";
8465 }
8466 }
8467 int i;
8468 for (i = num; i < length; i++)
8469 {
8470 if (value[i] != ' ')
8471 {
8472 continue;
8473 }
8474 int j;
8475 for (j = i + 1; j < length && value[j] == ' '; j++)
8476 {
8477 }
8478 if (j == length)
8479 {
8480 if (stringBuilder == null)
8481 {
8482 return value.Substring(num, i - num);
8483 }
8484 stringBuilder.Append(value, num, i - num);
8485 return stringBuilder.ToString();
8486 }
8487 if (j > i + 1)
8488 {
8489 if (stringBuilder == null)
8490 {
8492 }
8493 stringBuilder.Append(value, num, i - num + 1);
8494 num = j;
8495 i = j - 1;
8496 }
8497 }
8498 if (stringBuilder == null)
8499 {
8500 if (num != 0)
8501 {
8502 return value.Substring(num, length - num);
8503 }
8504 return value;
8505 }
8506 if (i > num)
8507 {
8508 stringBuilder.Append(value, num, i - num);
8509 }
8510 return stringBuilder.ToString();
8511 }

References System.Xml.Dictionary, System.length, and System.value.

Referenced by System.Xml.XmlTextReaderImpl.NodeData.TrimSpacesInValue().