I have a string, lets call it MyStr. I am trying to get rid of every non-alphabetical character in the string. Like, in IM’s like MSN and Skype, people put their display names like [-Bobby-]. I would like to remove everything in that string that is not an alphabetical character, so all I am left with, is the “name”.
How can I do that in Delphi? I was thinking about creating a TStringlist and store each valid character in there, and then use IndexOf to check if the char is valid, but I was hoping for an easier way.
The simplest approach is
but this will only consider English letters as “alphabetical characters”. It will not even consider the extremely important Swedish letters Å, Ä, and Ö as “alphabetical characters”!
Slightly more sophisticated is