Rabbinatix
Sign inGet started
Store

Number or text?

FreeLogic
@rabbinatix/number-or-text by Rabbinatixupdated Oct 4, 2026

Tells whether typed text is a number (`42`, `-3.5`) or plain text, and converts it.

Sign in to add

Text from a form is always a string, so Type Of would say string even for 42. A regular expression decides what counts as a number (here: an optional minus, digits and an optional decimal part), then To Number converts it. On its own To Number would accept the empty text (as 0), 1e3 and 0x1F.

Shows: Trim, Regex Match, Branch, To Number.

How to use it

Add it to your logic, then add a Call Function step in any logic and pick Number or text. It belongs to no system, so every system can use it. Or download the TypeScript and call it from your own code.

Inputs
text: Text
Outputs
kind: One of: number, text
value: Any value
Previewdrag the steps around; scroll to zoom
Function Entry, Input / output. 0 inputs, 2 outputs. step 1 of 7
Number or text
text
Trim, String. 1 input, 1 output. step 2 of 7
Trim
text
result
Regex Match, String. 1 input, 2 outputs. step 3 of 7
Regex Match
text
matches
groups
Branch, Flow control. 2 inputs, 2 outputs. step 4 of 7
Branch
condition
True
False
To Number, Data. 1 input, 2 outputs. step 5 of 7
To Number
value
result
valid
Return, Input / output. 3 inputs, 0 outputs. step 6 of 7
Return
kind
value
Return, Input / output. 3 inputs, 0 outputs. step 7 of 7
Return
kind
value

Arrow keys: next or previous step in flow order. Alt with arrows: nearest step in that direction. Enter: open. Shift F10: more actions.

100%
Examplesrun live against the logic · 4/4 pass
PassedExampleInputOutput
A whole number with spaces{"text":" 42 "}{"kind":"number","value":42}
A negative decimal{"text":"-3.5"}{"kind":"number","value":-3.5}
Text{"text":"12abc"}{"kind":"text","value":"12abc"}
Empty{"text":""}{"kind":"text","value":""}
Try it
Versions
In this package
Number or text (entry)