Normal
nice idea, especially thinking of people using a TV remote control. Coding is easy - doing it like this you can search both ways:Using lookup table (not complete here) mapping numbers to keys:[code] protected static String [] aCode = new String[3] { "2", "22", "222" }; protected static String [] aLetter = new String[3]{"a", "b", "c" };[/code]and changing thes earch to look for sSearch instead of sKey, with sSearch being[code] String sSearch = sKey; int nCode = Array.BinarySearch( aCode, sKey ); if ( nCode >= 0 ) { sSearch = aLetter[ nCode ]; } .... if ( strLabel.StartsWith(sSearch) )[/code]
nice idea, especially thinking of people using a TV remote control. Coding is easy - doing it like this you can search both ways:
Using lookup table (not complete here) mapping numbers to keys:
[code] protected static String [] aCode = new String[3] { "2", "22", "222" };
protected static String [] aLetter = new String[3]{"a", "b", "c" };
[/code]and changing thes earch to look for sSearch instead of sKey, with sSearch being
[code] String sSearch = sKey;
int nCode = Array.BinarySearch( aCode, sKey );
if ( nCode >= 0 )
{
sSearch = aLetter[ nCode ];
}
....
if ( strLabel.StartsWith(sSearch) )
[/code]