Axiom.RenderSystems.OpenGL.ATI.Compiler2Pass.IsFloatValue C# (CSharp) Method

IsFloatValue() protected method

Check to see if the text at the present position in the source is a numerical constant.
protected IsFloatValue ( float &val, int &length ) : bool
val float Receives the float value that is in the source.
length int Receives number of characters that make of the value in the source.
return bool
		protected bool IsFloatValue( out float val, out int length )
		{
			bool valueFound = false;

			int currPos = charPos;
			string floatString = "";
			bool firstNonSpace = false;

			char c = source[ currPos ];

			// have the out param at least set to 0
			val = 0.0f;
			length = 0;

			while ( Char.IsNumber( c ) || c == '.' || c == '-' || c == ' ' )
			{
				if ( c != ' ' && !firstNonSpace )
				{
					firstNonSpace = true;
				}

				if ( c == ' ' && firstNonSpace )
				{
					break;
				}
				else
				{
					length++;
				}

				floatString += c;
				c = source[ ++currPos ];
			}

			if ( charPos != currPos )
			{
				val = StringConverter.ParseFloat( floatString );
				valueFound = true;
			}

			return valueFound;
		}