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

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

Formats the specified number using the named ruleset.

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
A textual representation of the number. ICU 2.0

Definition at line 1129 of file rbnf.cpp.

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

    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(number, toAppendTo, toAppendTo.length());
    return toAppendTo;

Generated by  Doxygen 1.6.0   Back to index