Convert text (containing only numbers) to numbers

Hi folks! Bit of a conundrum.

I have a list of numbers that I pulled from a long comma separated text (using the “:split by (,)” function). However, I need Bubble to recognise these as numbers, not text (they are longitude & latitude co-ordinates). Seems like a very simple thing, but I can’t find a way. Can’t see any suitable plugin either.

Anyone got any ideas or has come across something similar?

Thanks!
Steve.

Doesn’t :converted to number suit you needs?

2 Likes

You mean you have a list of texts (containing numerical characters)…

to convert that into a list of numbers, just use :each item: converted to number on the list

1 Like

Thanks @artemzheg & @adamhholmes ! I didn’t have the :each item added so never got that option to convert to number. Will try that now, really appreciate the help!

Hey! I’m almost there, one weird hiccup - the conversion is ignoring the sign (i.e. it takes the absolute value of each amount). You can see in the screenshots below, the text separator is working fine, keeps the sign, but the conversion returns all positive values.

So, so close!!! (So, so frustrating :laughing:). Any tips on how to make it understand that a “-” is a negative?

Thanks again,
Steve.

Sorted! Had to go around the houses a bit, created a multiplier ‘state’ (1 or -1) determined by the presence of a “-” and applied that to the number.

Thanks a million both of you for the help!

Steve.

This topic was automatically closed after 70 days. New replies are no longer allowed.