Axiom.Scripting.ParseHelper.ReadLine C# (CSharp) Метод

ReadLine() публичный статический Метод

Helper method to nip/tuck the string before parsing it. This includes trimming spaces from the beginning and end of the string, as well as removing excess spaces in between values.
public static ReadLine ( TextReader reader ) : string
reader TextReader
Результат string
		public static string ReadLine( TextReader reader )
		{
			string line = reader.ReadLine();

			if ( line != null )
			{
				line = line.Replace( "\t", " " );
				line = line.Trim();

				// ignore blank lines, lines without spaces, or comments
				if ( line.Length == 0 || line.IndexOf( ' ' ) == -1 || line.StartsWith( "//" ) )
				{
					return line;
				}

				StringBuilder sb = new StringBuilder();

				string[] values = line.Split( ' ' );

				// reduce big space gaps between values down to a single space
				for ( int i = 0; i < values.Length; i++ )
				{
					string val = values[ i ];

					if ( val.Length != 0 )
					{
						sb.Append( val + " " );
					}
				}

				line = sb.ToString();
				line = line.TrimEnd();
			} // if

			return line;
		}