System.Net.Http.Headers.Lexer.PeekChar C# (CSharp) Method

PeekChar() public method

public PeekChar ( ) : int
return int
		public int PeekChar ()
		{
			return pos < s.Length ? s[pos] : -1;
		}

Usage Example

Ejemplo n.º 1
0
		internal static bool TryParse (string input, int minimalCount, out List<ProductInfoHeaderValue> result)
		{
			var list = new List<ProductInfoHeaderValue> ();
			var lexer = new Lexer (input);
			result = null;

			while (true) {
				ProductInfoHeaderValue element;
				if (!TryParseElement (lexer, out element))
					return false;

				if (element == null) {
					if (list != null && minimalCount <= list.Count) {
						result = list;
						return true;
					}

					return false;
				}

				list.Add (element);

				// Separator parsing
				switch (lexer.PeekChar ()) {
				case ' ':
				case '\t':
					lexer.EatChar ();
					continue;
				case -1:
					if (minimalCount <= list.Count) {
						result = list;
						return true;
					}

					break;
				}
					
				return false;
			}
		}
All Usage Examples Of System.Net.Http.Headers.Lexer::PeekChar