# How do you turn TEXT to NUMBER?

Note how I said text to number - not number to text.
Clarification - Lets say text is a then I need to get the number as 1 but I need to do that with a text string like `hi`

You could compare 2 properties, the text and the number, and replicate each with the new text blocks. Got it?

1 Like

what do you mean? @FusionLord

That would take a lot of memory @wingwave

What text do you want to convert to numbers?

@Beluga_Whale - Lets say I wanted to change `Text (1)` to `Number (1)`

@wingwave - Custom text.

you know with a keyboard

I could just do a = 1 but the text is a whole string - I also need an easier way to make this work.
@Blackhole927 , @Anonymous can you help?

i dont think they are awake rn

I think that youâ€™d just multiply it by 1.

I was actually drafting a guide for this. Basically there are two text operations that return a number. Length of and Find first occurrence of. Basically you need to compare one digit of your number to the string 0123456789 using the find first occurrence of. It will return the position starting at one so
It will return
1,2,3,4,5,6,7,8,9,10 respectively for
0,1,2,3,4,5,6,7,8,9

So basically you need to subtract one. I can send a ss in just a second.

What were you trying to say?

They mean screenshot. Also look at this post by bh:

1 Like

I donâ€™t understand @getrithekd .

You have to do recursion and everything. Have a property called â€śConvertRecursionâ€ť, have one trigger, and have it do something like â€śIf ConvertRecursion < length of (this text)â€ť

Do what @TorontoBulls1 did (replacing first with ConvertRecursion + 1), add the output of that * (10 ^ ConvertRecursion) and then add one to â€śConvertRecursionâ€ť and broadcast to a channel that triggers itself (inside of the â€śIfâ€ť block so it only recurses if ConvertRecursion is less than or equal to length).

Total memory cost should be like 550.

Heres the Screenshot

It can only handle one digit at a time so you will have to use recursion and an increasing property to extract large numbers from text

2 Likes

Oh that actually works much better than what I did, I forgot that even works (I just checked whether the text was 0, then 1, then etc.)

1 Like

This is also fairly compact so you can repeat it multiple time in one block.

This example deciphers the first three digits to numbers. If you wanted to do more you would use recursion to increment a property that would change the get letter number value.

FYI: if you try to decipher a letter instead of a number it will return -1 so if there is a chance of that just check to see if it is negative to remove that exception.

3 Likes

Multiply the text by 1.

Wdym by that @Blackhole927 .
@TorontoBulls1 - I probably shouldâ€™ve clarified - Lets say text is a then I need to get the number as 1 but I need to do that with a text string like `hi`