5
$\begingroup$

IntegerName returns the text of an integer. However, when Speak is applied to the result it stops at the fist hyphen.

For example

IntegerName[12345, "Words"]
"twelve thousand, three hundred forty-five"

But

Speak@IntegerName[12345, "Words"]

Only reads "twelve thousand, three hundred forty"

Similarly for

IntegerName[123456, "Words"]
"one hundred twenty-three thousand, four hundred fifty-six"

but

Speak@IntegerName[123456, "Words"]

Only reads "one hundred twenty"

Can anyone else confirm this behaviour? Win 8.1 Pro with Mma 11.0.1

I am attempting to use Mma to introduce primary school students computational thinking.

$\endgroup$
  • 1
    $\begingroup$ The problem seems to be the \hyphen in the output of IntegerName. If you replace this with a dash - it will read OK. $\endgroup$ – bill s Nov 28 '16 at 1:49
3
$\begingroup$

I can confirm the problem on my system.

$Version

(*  "11.0.1 for Mac OS X x86 (64-bit) (September 21, 2016)"  *)

As a workaround use StringReplace to replace the hyphen

IntegerName[12345, "Words"] // FullForm

(*  "twelve thousand, three hundred forty\[Hyphen]five"  *)

Speak@StringReplace[IntegerName[12345, "Words"], "‐" :> " "]

Speak@StringReplace[IntegerName[123456, "Words"], "‐" :> " "]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.