ICSharpCode.NRefactory.CSharp.TextWriterTokenWriter.AppendChar C# (CSharp) Method

AppendChar() static private method

static private AppendChar ( StringBuilder sb, char ch ) : void
sb StringBuilder
ch char
return void
		static void AppendChar(StringBuilder sb, char ch)
		{
			switch (ch) {
				case '\\':
					sb.Append("\\\\");
					break;
				case '\0':
					sb.Append("\\0");
					break;
				case '\a':
					sb.Append("\\a");
					break;
				case '\b':
					sb.Append("\\b");
					break;
				case '\f':
					sb.Append("\\f");
					break;
				case '\n':
					sb.Append("\\n");
					break;
				case '\r':
					sb.Append("\\r");
					break;
				case '\t':
					sb.Append("\\t");
					break;
				case '\v':
					sb.Append("\\v");
					break;
				default:
					if (char.IsControl(ch) || char.IsSurrogate(ch) ||
					    // print all uncommon white spaces as numbers
					    (char.IsWhiteSpace(ch) && ch != ' ')) {
						sb.Append("\\u");
						sb.Append(((int)ch).ToString("x4"));
					} else {
						sb.Append(ch);
					}
					break;
			}
		}