Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MAXIMA string to integer conversion

Tags:

string

maxima

I am reading a list with 2 integers from a file using readline(s) which returns a string. How does one convert the string of 2 integers back to 2 integers? Thanks.

like image 881
sven Avatar asked Jun 20 '26 04:06

sven


1 Answers

I assume you have a string like "123 456". If so you can do this: map(parse_string, split(s)) where s is your string.

parse_string parses one Maxima expression, e.g. one integer. To get both integers, split the string, which makes a list, and then parse each element of the list.

like image 192
Robert Dodier Avatar answered Jun 23 '26 11:06

Robert Dodier



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!