AT.MIN.Tools.ReplaceMetaCharsMatch C# (CSharp) Method

ReplaceMetaCharsMatch() private static method

private static ReplaceMetaCharsMatch ( Match m ) : string
m System.Text.RegularExpressions.Match
return string
		private static string ReplaceMetaCharsMatch( Match m )
		{
			// convert octal quotes (like \040)
			if ( m.Groups[2].Length == 3 )
				return Convert.ToChar( Convert.ToByte( m.Groups[2].Value, 8 ) ).ToString();
			else
			{
				// convert all other special meta characters
				//TODO: \xhhh hex and possible dec !!
				switch ( m.Groups[2].Value )
				{
					case "0":           // null
						return "\0";
					case "a":           // alert (beep)
						return "\a";
					case "b":           // BS
						return "\b";
					case "f":           // FF
						return "\f";
					case "v":           // vertical tab
						return "\v";
					case "r":           // CR
						return "\r";
					case "n":           // LF
						return "\n";
					case "t":           // Tab
						return "\t";
					default:
						// if neither an octal quote nor a special meta character
						// so just remove the backslash
						return m.Groups[2].Value;
				}
			}
		}
		#endregion