Logo Search packages:      
Sourcecode: icu version File versions  Download package

UnicodeString & RuleBasedNumberFormat::format ( int32_t  number,
const UnicodeString ruleSetName,
UnicodeString toAppendTo,
FieldPosition pos,
UErrorCode status 
) const [virtual]

Formats the specified number using the named ruleset.

Parameters:
number The number to format.
ruleSetName The name of the rule set to format the number with. This must be the name of a valid public rule set for this formatter.
toAppendTo the string that will hold the (appended) result
pos the fieldposition
status the status
Returns:
A textual representation of the number. ICU 2.0

Definition at line 1074 of file rbnf.cpp.

References UnicodeString::indexOf(), UnicodeString::length(), U_ILLEGAL_ARGUMENT_ERROR, and U_SUCCESS.

{
    // return format((int64_t)number, ruleSetName, toAppendTo, pos, status);
    if (U_SUCCESS(status)) {
        if (ruleSetName.indexOf(gPercentPercent) == 0) {
            // throw new IllegalArgumentException("Can't use internal rule set");
            status = U_ILLEGAL_ARGUMENT_ERROR;
        } else {
            NFRuleSet *rs = findRuleSet(ruleSetName, status);
            if (rs) {
                rs->format((int64_t)number, toAppendTo, toAppendTo.length());
            }
        }
    }
    return toAppendTo;
}


Generated by  Doxygen 1.6.0   Back to index