System.__DTString.Match C# (CSharp) Method

Match() private method

private Match ( String str ) : bool
str String
return bool
        internal bool Match(String str) {
            if (++Index >= len) {
                return (false);
            }

            if (str.Length > (Value.Length - Index)) {
                return false;
            }

            if (m_info.Compare(Value, Index, str.Length, str, 0, str.Length, CompareOptions.Ordinal)==0) {
                // Update the Index to the end of the matching string.
                // So the following GetNext()/Match() opeartion will get
                // the next character to be parsed.
                Index += (str.Length - 1);
                return (true);
            }
            return (false);
        }

Same methods

__DTString::Match ( char ch ) : bool

Usage Example

		private static bool ParseTimeZoneOffset(ref __DTString str, int len, ref TimeSpan result)
		{
			bool flag = true;
			int num = 0;
			int hours;
			switch (len)
			{
				case 1:
				case 2:
				{
					if (!DateTimeParse.ParseSign(ref str, ref flag))
					{
						return false;
					}
					if (!DateTimeParse.ParseDigits(ref str, len, out hours))
					{
						return false;
					}
					break;
				}
				default:
				{
					if (!DateTimeParse.ParseSign(ref str, ref flag))
					{
						return false;
					}
					if (!DateTimeParse.ParseDigits(ref str, 1, out hours))
					{
						return false;
					}
					if (str.Match(":"))
					{
						if (!DateTimeParse.ParseDigits(ref str, 2, out num))
						{
							return false;
						}
					}
					else
					{
						str.Index--;
						if (!DateTimeParse.ParseDigits(ref str, 2, out num))
						{
							return false;
						}
					}
					break;
				}
			}
			if (num < 0 || num >= 60)
			{
				return false;
			}
			result = new TimeSpan(hours, num, 0);
			if (!flag)
			{
				result = result.Negate();
			}
			return true;
		}
All Usage Examples Of System.__DTString::Match