Operators [] as string block

can someone make/help me make a block that turns a text form of a number to a number? (and the other way around)

A string of digits is already a number. Do you mean something else? Do you mean a number spelled out in words, like "six thousand"?

yes!

Well, start with al. Then I guess I'd build an association list with words and meanings: six -> 6, hundred -> h.

1: that topic is closed
2: this topic also focuses on a block that does the opposite of that

oh and before splitting into words, turn all the hyphens into spaces, e.g. "twenty-three" means the same as "twenty three."

I just need help with the do something with [] [] stuff, where it makes a separator for the "smaller" numbers instead of a space.
edit: it's broken, I need more help.

Okay. First of all, you shouldn't need entries for things like "twenty five" in your dictionary. "Twenty" is 20 and "five" is 5. Other words act as multipliers, which is why I suggested a times block for them, but you don't have to do it that way.

Almost all the multipliers use up the number in front of them -- twenty four million three thousand means (24 x 1000000)+(3 x 1000), not ((24 x 1000000) + 3) x 1000. The only special case is "hundred," which does participate in the following multiplier: "six hundred thousand" is (6 x 100) x 1000.

So you need to keep track of two numbers, one for the part you're completely done with and one for the current group of up to three digits before a big multiplier.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.