internal string Normalize(string s, XsdWhitespaceFacet whitespaceFacet) { int idx = s.IndexOfAny(wsChars); if (idx < 0) { return(s); } switch (whitespaceFacet) { case XsdWhitespaceFacet.Collapse: string [] arr = s.Trim().Split(wsChars); for (int i = 0; i < arr.Length; i++) { string one = arr [i]; if (one != "") { sb.Append(one); sb.Append(" "); } } string result = sb.ToString(); sb.Length = 0; return(result.Trim()); case XsdWhitespaceFacet.Replace: sb.Length = 0; sb.Append(s); for (int i = 0; i < sb.Length; i++) { switch (sb [i]) { case '\r': case '\n': case '\t': sb [i] = ' '; break; } } result = sb.ToString(); sb.Length = 0; return(result); default: return(s); } }
internal string Normalize(string s, XsdWhitespaceFacet whitespaceFacet) { int num = s.IndexOfAny(XmlSchemaDatatype.wsChars); if (num < 0) { return(s); } string text; if (whitespaceFacet == XsdWhitespaceFacet.Replace) { this.sb.Length = 0; this.sb.Append(s); for (int i = 0; i < this.sb.Length; i++) { switch (this.sb[i]) { case '\t': case '\n': case '\r': this.sb[i] = ' '; break; } } text = this.sb.ToString(); this.sb.Length = 0; return(text); } if (whitespaceFacet != XsdWhitespaceFacet.Collapse) { return(s); } foreach (string text2 in s.Trim().Split(XmlSchemaDatatype.wsChars)) { if (text2 != string.Empty) { this.sb.Append(text2); this.sb.Append(" "); } } text = this.sb.ToString(); this.sb.Length = 0; return(text.Trim()); }
internal string Normalize (string s, XsdWhitespaceFacet whitespaceFacet) { int idx = s.IndexOfAny (wsChars); if (idx < 0) return s; switch (whitespaceFacet) { case XsdWhitespaceFacet.Collapse: string [] arr = s.Trim ().Split (wsChars); for (int i = 0; i < arr.Length; i++) { string one = arr [i]; if (one != "") { sb.Append (one); sb.Append (" "); } } string result = sb.ToString (); sb.Length = 0; return result.Trim (); case XsdWhitespaceFacet.Replace: sb.Length = 0; sb.Append (s); for (int i = 0; i < sb.Length; i++) switch (sb [i]) { case '\r': case '\n': case '\t': sb [i] = ' '; break; } result = sb.ToString (); sb.Length = 0; return result; default: return s; } }