public static isAlphaNum ( long self ) : bool | ||
self | long | |
return | bool |
public static bool isAlphaNum(long self)
{
try
{
return (self < 128 && (charMap[(int)self] & ALPHANUM) != 0);
}
catch (IndexOutOfRangeException)
{
// should be very rare to use this method with negative
// numbers, so don't take the hit every call
return false;
}
}
public static Regex glob(string pattern) { StringBuilder s = new StringBuilder(); for (int i = 0; i < pattern.Length; ++i) { int c = pattern[i]; if (FanInt.isAlphaNum(c)) { s.Append((char)c); } else if (c == '?') { s.Append('.'); } else if (c == '*') { s.Append('.').Append('*'); } else { s.Append('\\').Append((char)c); } } return(new Regex(s.ToString())); }