src/third_party/icu/source/i18n/units_converter.cpp
/*
 * Extracts `Factor` from a complete string factor. e.g. "ft2m^3*1007/cup2m3*3"
 */
Extracts `Factor` from a complete string factor.
Extracts ` Factor ` from a complete string factor .
Factor extractFactorConversions(StringPiece stringFactor, UErrorCode &status) {
    Factor result;
    Signum signum = Signum::POSITIVE;
    auto factorData = stringFactor.data();
    for (int32_t i = 0, start = 0, n = stringFactor.length(); i < n; i++) {
        if (factorData[i] == '*' || factorData[i] == '/') {
            StringPiece factorElement = stringFactor.substr(start, i - start);
            addFactorElement(result, factorElement, signum, status);
            start = i + 1; 
        } else if (i == n - 1) {
            addFactorElement(result, stringFactor.substr(start, i + 1), signum, status);
        }
        if (factorData[i] == '/') {
            signum = Signum::NEGATIVE; 
        }
    }
    return result;
}
Factor extractFactorConversions ( StringPiece stringFactor , UErrorCode & status ) { Factor result ; Signum signum = Signum :: POSITIVE ; auto factorData = stringFactor . data ( ) ; for ( int32_t i = 0 , start = 0 , n = stringFactor . length ( ) ; i < n ; i ++ ) { if ( factorData [ i ] == ' ' || factorData [ i ] == ' ' ) { StringPiece factorElement = stringFactor . substr ( start , i - start ) ; addFactorElement ( result , factorElement , signum , status ) ; start = i + 1 ; } else if ( i == n - 1 ) { addFactorElement ( result , stringFactor . substr ( start , i + 1 ) , signum , status ) ; } if ( factorData [ i ] == ' ' ) { signum = Signum :: NEGATIVE ; } } return result ; }
Extracts `Factor` from a complete string factor.
Extracts ` Factor ` from a complete string factor .
// Set `start` to point to the start of the new element. // Last element // Change the signum because we reached the Denominator.