3rdparty/NRefactory/ICSharpCode.NRefactory.Xml/TagReader.cs
/// <summary> Remove quoting from the given string </summary>
Remove quoting from the given string
Remove quoting from the given string
static string Unquote(string quoted)
		{
			if (string.IsNullOrEmpty(quoted)) return string.Empty;
			char first = quoted[0];
			if (quoted.Length == 1) return (first == '"' || first == '\'') ? string.Empty : quoted;
			char last  = quoted[quoted.Length - 1];
			if (first == '"' || first == '\'') {
				if (first == last) {
					return quoted.Substring(1, quoted.Length - 2);
				} else {
					return quoted.Remove(0, 1);
				}
			} else {
				if (last == '"' || last == '\'') {
					return quoted.Substring(0, quoted.Length - 1);
				} else {
					return quoted;
				}
			}
		}
static string Unquote ( string quoted ) { if ( string . IsNullOrEmpty ( quoted ) ) return string . Empty ; char first = quoted [ 0 ] ; if ( quoted . Length == 1 ) return ( first == ' ' || first == ' \' ' ) ? string . Empty : quoted ; char last = quoted [ quoted . Length - 1 ] ; if ( first == ' ' || first == ' \' ' ) { if ( first == last ) { return quoted . Substring ( 1 , quoted . Length - 2 ) ; } else { return quoted . Remove ( 0 , 1 ) ; } } else { if ( last == ' ' || last == ' \' ' ) { return quoted . Substring ( 0 , quoted . Length - 1 ) ; } else { return quoted ; } } }
Remove quoting from the given string
Remove quoting from the given string
// Remove both quotes // Remove first quote // Remove last quote // Keep whole string
quoted
string