How can I make the following function to retrieve only digit portion from the TokenName and use it on chain?
For example I want to retrieve the number 123 from "AAA123" (TokenName)
{-# INLINABLE getIdFromTokenName #-}
getIdFromTokenName :: TokenName -> Integer
getIdFromTokenName tn = ...
and I have the check function for state machine, as follows:
{-# INLINABLE check #-}
check :: Game -> GameDatum -> GameRedeemer -> ScriptContext -> Bool
check g _ (Buy tn) _ = ix > 0 && gMaxItems g >= ix
where
ix = getIdFromTokenName tn