src/lib/fxl/strings/substitute.cc
// Returns the type of character, and positional id if type is kPositionalId.
Returns the type of character, and positional id if type is kPositionalId.
Returns the type of character and positional id if type is kPositionalId .
inline static std::pair<CharType, size_t> GetCharInfo(std::string_view str, size_t pos) {
  if (str[pos] == '$' && pos < str.size() - 1 && str[pos + 1] >= '0' && str[pos + 1] <= '9') {
    return {CharType::kPositionalId, str[pos + 1] - '0'};
  }
  if (pos == str.size() - 1 && str[pos] == '$') {
    return {CharType::kMissingId, -1};
  }
  if (pos < str.size() - 1 && str[pos] == '$' && str[pos + 1] == '$') {
    return {CharType::kDollar, -1};
  }
  return {CharType::kRegularChar, -1};
}
inline static std :: pair < CharType , size_t > GetCharInfo ( std :: string_view str , size_t pos ) { if ( str [ pos ] == ' ' && pos < str . size ( ) - 1 && str [ pos + 1 ] >= ' ' && str [ pos + 1 ] <= ' ' ) { return { CharType :: kPositionalId , str [ pos + 1 ] - ' ' } ; } if ( pos == str . size ( ) - 1 && str [ pos ] == ' ' ) { return { CharType :: kMissingId , -1 } ; } if ( pos < str . size ( ) - 1 && str [ pos ] == ' ' && str [ pos + 1 ] == ' ' ) { return { CharType :: kDollar , -1 } ; } return { CharType :: kRegularChar , -1 } ; }
Returns the type of character, and positional id if type is kPositionalId.
Returns the type of character and positional id if type is kPositionalId .