Was looking for something like Matlab's num2str function. I'm trying to use Grid to format output from a print statement, but some of the cells are complex like
"distance result = ", list[[2]], " meters "
The Print function has no problem with that
Print["distance result = ", list[[2]], " meters "]
Print["time result = ", list[[3]], " days "]
but if I try
Grid[{{"distance result = " <> IntegerString[list[[2]]]}," meters "},{"time result = " <> IntegerString[list[[3]]]," days "}},Alignment-> Left]
This only works if list[[2]] and list[[3]] are integers. How do I do this if list contains real numbers, i.e., IntegerString no longer works? I would like meters and days to be vertically aligned. I think I need to intermix text and real numbers inside a single grid cell. Maybe there is a better way to format outputs? Do I put separate Print statements inside each Grid cell? Not sure how to get properly formatted multi-line output in notebooks.
ToString
should do it $\endgroup$