System.Globalization.CultureData.UnescapeNlsString C# (CSharp) Method

UnescapeNlsString() static private method

static private UnescapeNlsString ( String str, int start, int end ) : String
str String
start int
end int
return String
		static private String UnescapeNlsString(String str, int start, int end)
		{
			Contract.Requires(str != null);
			Contract.Requires(start >= 0);
			Contract.Requires(end >= 0);
			StringBuilder result = null;

			for (int i = start; i < str.Length && i <= end; i++)
			{
				switch (str[i])
				{
					case '\'':
						if (result == null)
						{
							result = new StringBuilder(str, start, i - start, str.Length);
						}
						break;
					case '\\':
						if (result == null)
						{
							result = new StringBuilder(str, start, i - start, str.Length);
						}
						++i;
						if (i < str.Length)
						{
							result.Append(str[i]);
						}
						break;
					default:
						if (result != null)
						{
							result.Append(str[i]);
						}
						break;
				}
			}

			if (result == null)
				return (str.Substring(start, end - start + 1));

			return (result.ToString());
		}