Message Boards Message Boards


StringTake text and number. How to convert a text to a real number?

Posted 9 years ago
2 Replies
1 Total Likes

Hi, I have this text string aa = {Cp11 t -40.00 r 3.73.csv }, I want to extract the number 3.73, so i write:

rapp = StringTake[StringDrop[aa, -4], -4]

So I have as result {"3.73"}. But it's in a text format.

How to convert the rapp = {"3.73"} to number format, so that i can use 3.73 to calculate ?

I hope in your help!


2 Replies

thank you!

The function for this is called "ToExpression". It takes a string and converts it into an expression in the Wolfram Language:

ToExpression["3.77"] + 1
POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract