# How to tell whether a character is a letter-like form

Is there any way to programmatically tell whether a given character is a letter or letter-like form (see this reference page for what I mean)?

One idea I had was to use FrontEndUndocumentedTestFEParserPacket, to test whether the syntax parser would split the string (i.e. test whether char <> "a" is split), which seems to work. But I am looking for a more provably correct and less undocumented solution if at all possible.

Another idea was to simply check the reference page for a given character/preprocess the full list given above to build a "database" by hand, but it feels like there could be a more straightforward way, hence this question.

• Yes, there is LetterQ. – Henrik Schumacher Apr 7 '18 at 9:40
• @HenrikSchumacher: That doesn't work on some characters though: LetterQ@"\[Bullet]" returns False... – Lukas Lang Apr 7 '18 at 9:43
• Does SyntaxQ plus a check for numerics not work? – b3m2a1 Apr 9 '18 at 8:46
• @b3m2a1 No, SyntaxQ@"?" is True unfortunately... – Lukas Lang Apr 9 '18 at 11:54

Hm. Searching for every command involving Letter with **Letter*, I found SystemConvertMLStringDataDumpLetterLikeQ. If s is a String, it applies SystemConvertMLStringDataDumpLetterLikeAuxQ to Characters[s] and wraps it with And@@, so it seems to check if a string is entirely composed of letter like characters. Actually, the whole context SystemConvertMLStringDataDump seems to be interesting for you.

• Thanks! I should really get into the habit of searching functions like this... I just hope this covers all cases, as the list appears to be mostly hard-coded (or rather the complement is) - but since operators aren't changed to frequently, I don't think I need to worry too much. Anyway, this will definitely be the solution I'll use :) – Lukas Lang Apr 7 '18 at 10:06
• You're welcome. I hope it works out! – Henrik Schumacher Apr 7 '18 at 10:17

Reading the documentation of Symbol, the following should work:

LetterLikeQ[char_] := Module[
{ret},
Begin["llq"];
ret = Quiet@Check[Remove@Evaluate@Symbol@char; True, False];
End[];
ret
]


Some examples:

LetterLikeQ["a"]
(* True *)

LetterLikeQ["•"]
(* True *)

LetterLikeQ["\[Rule]"]
(* False *)

• Interesting approach. Should be less hacky with InternalSymbolNameQ. – Henrik Schumacher Apr 8 '18 at 8:34
• Good point - then this solution would also be a one-liner (LetterLikeQ=InternalSymbolNameQ)... But in that case I'd still prefer your solution, since both are undocumented, and yours is clearer in its intention – Lukas Lang Apr 8 '18 at 9:23