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

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

Formats the specified 64-bit 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.1

Definition at line 1097 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