omni::extras::stringToInt2

Defined in omni/extras/StringHelpers.h

inline bool omni::extras::stringToInt2(const std::string &str, carb::Int2 &outResult, const char *delims = kInt2Delimiters)

Converts a string value to an Int2 representation, that is, a two-component vector.

This function attempts to convert values such as 0,-1 or 99x84 into a carb::Int2. The delimiters given by delims are tried in order, passed along with str to split(). If two components are found, both components must successfully parse with stringToInteger() in order to consider the result valid.

Warning

See the warnings at stringToInteger() about potential data loss.

Parameters
  • str – The string to convert

  • outResult[out] Reference that receives the carb::Int2 result from parsing. Only valid if true is returned.

  • delims – Delimiters to separate the vector components

Returns

true if parsing was successful; false otherwise