I try to avoid relying on exceptions to validate user input.
I think that's what the methods of SymbolUtilityServices like ValidateCompatibleSymbolName, etc....., do as in throws an exceptions instead of return a bool or some other meaningful value.
Man I was wasting some memory,
I was creating an array of bools like bool[1++] or however many up to highest number for char that could be entered on the keyboard and defaulting them to false then using the chars as the index to set the index for invalid chars to true. The little boost in efficiency is probably not worth the memory used.
Do not have it in front of me but something like
static bool[] invalidChars = new bool[126];
static PooClass()
{
invalidChars['|'] = true;
invalidChars[','] = true;
etc....
}
I think its time to update to something like Tony example.
Also to throw it out there for creating methods for validating names for Dictionaries and SymbolTableRecord names there are some 'gotchas' for AutoCAD's standards containers you would think follow the normal pattern but do not.
I will see if I can dig them back up but like Group names can never be more 32 characters long and does not matter what EXTNAMES is set to, among some other.