I have a Shortcut that I can ask for local bus detours. Most of our buses are number routes, but there are some letter routes.
The API requires requests in the form of ?route=17 or ?route=XH.
When using “ask for input”, if you say “seventeen” sometimes you’ll get “seventeen” and sometimes you’ll get “17”. In cases of the former, I’d like to pump the text through the Number block.
The problem is that the Number block will hard-error and crash the Shortcut if you try to pass a string that can’t be converted to a number.
What I’m looking for is more of the “match text” behavior, where if nothing fits it just has empty output.
You could use the numeral ‘trick’. Slow, but should force to numerics.
You could use the Get Numbers From Input action, which doesn’t hard error.
Use the replace text action to replace the word Seventeen for the number 17.
That would be kind of silly, as I’d have to do that for every possible number.
The actual solution is what Roger suggested: use “get numbers from input” which returns “No” if there’s no numbers, versus “Number”, which behaves the same way but throws a crash if it can’t derive a number.
Fair enough, now that you mention it that wouldn’t be logical indeed. Good to read your problem has been solved @radiocolin and my compliments to @RogerDowning.