CK.Text.StringMatcher.MatchChar C# (CSharp) Method

MatchChar() public method

Matches an exact single character. If match fails, SetError is called.
public MatchChar ( char c ) : bool
c char The character that must match.
return bool
        public bool MatchChar( char c ) => TryMatchChar( c ) ? SetSuccess() : SetError( c );

Usage Example

        private static void CheckDateTimeStamp( DateTimeStamp t )
        {
            string s = t.ToString();
            var m = new StringMatcher( "X" + s + "Y" );
            Assert.That( m.MatchChar( 'X' ) );
            DateTimeStamp parsed;
            Assert.That( m.MatchDateTimeStamp( out parsed ) && parsed == t );
            Assert.That( m.MatchChar( 'Y' ) );

            m = new StringMatcher( s.Insert( 2, "X" ) );
            Assert.That( m.MatchDateTimeStamp( out parsed ), Is.False );
            Assert.That( m.ErrorMessage, Is.Not.Null );
            int i;
            Assert.That( m.MatchInt32( out i ) && i == 20 );
        }
All Usage Examples Of CK.Text.StringMatcher::MatchChar