I'm trying to draw stones on a grid, and my macro API will have two ways of doing it: either you give the X and Y coordinates, or you give it a string of the coordinates. So, for example, ab should be X = 1 and Y = 2.
Following this answer by @PhelypeOleinik, I'm now trying this:
\documentclass{article}
\usepackage{xstring}
\newcommand\makeFromAlph[1]{
\number\numexpr#1-a\relax % I should probably lowercase #1 first...
}
% I've also tried this version:
% \ExplSyntaxOn
% \NewExpandableDocumentCommand \makeFromAlph { m }
% { \int_eval:n { \int_from_alph:n {#1} - 1 } }
% \ExplSyntaxOff
\begin{document}
\StrRight{ab}{1} % This works
\makeFromAlph{\StrRight{ab}{1}} % But this doesn't
\end{document}
But it's giving me this error message:
Improper alphabetic constant.
<to be read again>
Does anyone know why? Is the output from \StrRight not yielding something that's considered a single character maybe? How do I fix this?

\@firstoftwo aband\@secondoftwo abto getaandbrespectively by expansion without using xstring (or L3) – David Carlisle Feb 06 '24 at 19:03L3allows doing a lot of things easily. – projetmbc Feb 06 '24 at 19:03