String to Double

As a thank you, here's my humble contribution to the community.
I myself have struggled with string, where it had to be a number.
Apparently I wasn't the first, see these posts:

I tried the above solution of adding a zero to the string (string + 0), but then the error popped up somewhere else in the code.
I was working with sentences loaded from a tinyDB from where I had to extract a number, which was then obviously a string.
Applied the trick string+0 and stored that in a list.
As I then had to bubble-sort that list, the + sign was the problem.
I kept patching the code by adding variables and stuf to get it working.
But that was a big detour.

So I quickly created this small extension to deal with this problem, and to stop using tricks like +0 or *1.
(I updated the extension to comply with the naming conventions)

Blocks
blocks1

Usage
blocks2
blocks3

StringToDouble.aix (4.6 KB)

This way your code looks much neater :slightly_smiling_face:

3 Likes

Thank you for your contribution

However I do not understand, in which circumstances this can he useful... can you provide an usage example?

And please adjust the extension to follow the naming conventions, see here

I will unlist this thread meanwhile...
Thank you

Taifun

Thanks for your contribution, but this can already be accomplished with built in blocks.

Hi Gordon,

I know, and I used that trick but that does not work in all cases, so I quickly build this extension for myself and problem solved.
In some cases the program does not accept a "+" or "*" sign in the code.
Believe me, I once had this error and I spent all day looking for a solution so I got fed up with it.
Now, when I get this error, I simply put this tiny block in and problem solved.

2 Likes

Thank you.

Please include all the information you have provided in these posts, including the new version of the extension which follows the naming conventions, into the main post, and we will list it.

which cases?

No, all information from the replies you posted in this topic.

That is an html encoding thing, it doesn't like a + sign. Just do the conversion before setting the tooltip data.

I was wrong Tim, it wasn't that.
See above.

moved this ^^^ post to here from the ChartMakePlus topic.