C++ guide and API reference#

Include isaacsim/common/string/String.hpp and link isaacsim::common-string.

All examples on this page assume the following namespace alias:

#include <isaacsim/common/string/String.hpp>

namespace string = isaacsim::common::string;

Case conversion#

toLower() and toUpper() return a copy of the input string with every character converted to lowercase or uppercase, respectively:

string::toLower("Isaac Sim");  // "isaac sim"
string::toUpper("Isaac Sim");  // "ISAAC SIM"

Color resolution#

resolveColor() parses a matplotlib-style color specification and returns its RGB components as three normalized floats in the 0-1 range. It mirrors matplotlib’s to_rgb and accepts:

  • #rgb / #rrggbb short and full hex (case-insensitive; #rgba / #rrggbbaa is accepted and the alpha channel is discarded).

  • Grayscale strings such as "0.5" (a float in the 0-1 range).

  • Single-letter base colors such as "k".

  • X11/CSS4 named colors such as "AquaMarine" (case-insensitive).

  • Tableau colors such as "tab:Green" (case-insensitive).

  • The CN cycle specification, such as "C2".

  • "none" (case-insensitive), the fully transparent color, resolved to black {0, 0, 0}.

string::resolveColor("#ff8800");   // {1.0f, 0.533f, 0.0f}
string::resolveColor("tab:green"); // Tableau green
string::resolveColor("C2");        // third color in the default cycle
string::resolveColor("0.5");       // {0.5f, 0.5f, 0.5f}

resolveColor() throws std::invalid_argument when the input is not a recognized color specification.

API reference#

Fully qualified namespace: isaacsim::common::string

namespace string#

Functions Summary#

std::string join(const std::vector< std::string > &strings, const std::string &separator)

Join a vector of strings with a separator.

std::vector< float > resolveColor(const std::string &color)

Resolve a matplotlib-style color specification to a vector of 3 normalized RGB float components.

std::vector< std::string > sort(const std::vector< std::string > &strings, bool ascending=true)

Sort a vector of strings.

std::vector< std::string > split(const std::string &text, const std::string &separator)

Split a string into a vector of strings using a separator.

std::string toLower(const std::string &text)

Convert all characters in a string to lowercase.

std::string toUpper(const std::string &text)

Convert all characters in a string to uppercase.

Structs Summary#

VectorStringHasher

Hash functor for std::vector<std::string> , e.g.