String Manipulation

There are a couple classes and functions to help manipulate strings of text. Conversion routines for std::string objects are given in string_conv.h and include

(While o2scl::dtos() and similar functions have been implemented in std::to_string, these functions do not allow as much flexbility so the C++11 version is not used.)

The o2scl::columnify class converts a set of strings into nicely formatted columns by padding with the necessary amount of spaces. This class operates on string objects of type std::string, and also works will for formatting columns of floating-point numbers. This class is used to provide output for matrices in the functions o2scl::matrix_out().

The o2scl::format_float class will reformat double precision numbers into a form appropriate for HTML or LaTeX documents.

A related function, o2scl::screenify(), reformats a column of strings into many columns stored row-by-row in a new string array. It operates very similar to the way the classic Unix command ls organizes files and directories in multiple columns in order to save screen space.

The function o2scl::function_to_double() converts strings like "1.0/3.0" and "exp(cos(-1.0e-2))" to double-precision floating point numbers using o2scl::calculator .

The function o2scl::size_of_exponent() returns 2 or 3, depending on the number of characters in the exponent when a floating point number is output to the screen.

Finally, the function o2scl::count_words() counts the number of "words" in a string, which are delimited by whitespace.

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).