specfem::utilities::to_zero_lead

std::string specfem::utilities::to_zero_lead(const int value, const int n_zero)

Convert integer to string with leading zeros.

Converts an integer to a string with zero-padding to ensure a minimum number of digits. Useful for creating numbered filenames or identifiers.

to_zero_lead(42, 5);  // Returns "00042"
to_zero_lead(1234, 3); // Returns "1234" (no padding needed)

Parameters:
  • value – Integer value to convert

  • n_zero – Minimum number of digits in the output string

Returns:

std::string Zero-padded string representation

specfem::utilities::snake_to_pascal

std::string specfem::utilities::snake_to_pascal(const std::string &str)

Convert snake_case string to PascalCase.

Transforms a string from snake_case (words separated by underscores) to PascalCase (capitalized words without separators).

snake_to_pascal("my_variable_name"); // Returns "MyVariableName"

Parameters:

str – Input string in snake_case format

Returns:

std::string String converted to PascalCase

specfem::utilities::to_lower

std::string specfem::utilities::to_lower(const std::string &str)

Convert string to lowercase.

to_lower("HELLO World"); // Returns "hello world"

Parameters:

str – Input string

Returns:

std::string Lowercase version of the input string