ICU-1997 isRuleWhiteSpace (sigh)
X-SVN-Rev: 9382
This commit is contained in:
parent
649057f2f3
commit
1d3acd2f52
@ -5,20 +5,22 @@
|
|||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*
|
*
|
||||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/NFRule.java,v $
|
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/NFRule.java,v $
|
||||||
* $Date: 2002/02/16 03:06:09 $
|
* $Date: 2002/07/26 22:51:50 $
|
||||||
* $Revision: 1.4 $
|
* $Revision: 1.5 $
|
||||||
*
|
*
|
||||||
*****************************************************************************************
|
*****************************************************************************************
|
||||||
*/
|
*/
|
||||||
package com.ibm.icu.text;
|
package com.ibm.icu.text;
|
||||||
|
|
||||||
|
import com.ibm.icu.impl.UCharacterProperty;
|
||||||
|
|
||||||
import java.text.*;
|
import java.text.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class represnting a single rule in a RuleBasedNumberFormat. A rule
|
* A class represnting a single rule in a RuleBasedNumberFormat. A rule
|
||||||
* inserts its text into the result string and then passes control to its
|
* inserts its text into the result string and then passes control to its
|
||||||
* substitutions, which do the same thing.
|
* substitutions, which do the same thing.
|
||||||
* $RCSfile: NFRule.java,v $ $Revision: 1.4 $ $Date: 2002/02/16 03:06:09 $
|
* $RCSfile: NFRule.java,v $ $Revision: 1.5 $ $Date: 2002/07/26 22:51:50 $
|
||||||
*/
|
*/
|
||||||
final class NFRule {
|
final class NFRule {
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
@ -253,7 +255,7 @@ final class NFRule {
|
|||||||
// description
|
// description
|
||||||
descriptor = description.substring(0, p);
|
descriptor = description.substring(0, p);
|
||||||
++p;
|
++p;
|
||||||
while (p < description.length() && Character.isWhitespace(description.charAt(p)))
|
while (p < description.length() && UCharacterProperty.isRuleWhiteSpace(description.charAt(p)))
|
||||||
++p;
|
++p;
|
||||||
description = description.substring(p);
|
description = description.substring(p);
|
||||||
|
|
||||||
@ -292,7 +294,7 @@ final class NFRule {
|
|||||||
else if (c == '/' || c == '>') {
|
else if (c == '/' || c == '>') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (Character.isWhitespace(c) || c == ',' || c == '.') {
|
else if (UCharacterProperty.isRuleWhiteSpace(c) || c == ',' || c == '.') {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new IllegalArgumentException("Illegal character in rule descriptor");
|
throw new IllegalArgumentException("Illegal character in rule descriptor");
|
||||||
@ -320,7 +322,7 @@ final class NFRule {
|
|||||||
else if (c == '>') {
|
else if (c == '>') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (Character.isWhitespace(c) || c == ',' || c == '.') {
|
else if (UCharacterProperty.isRuleWhiteSpace(c) || c == ',' || c == '.') {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new IllegalArgumentException("Illegal character is rule descriptor");
|
throw new IllegalArgumentException("Illegal character is rule descriptor");
|
||||||
|
@ -5,13 +5,15 @@
|
|||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*
|
*
|
||||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/NFRuleSet.java,v $
|
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/NFRuleSet.java,v $
|
||||||
* $Date: 2002/02/16 03:06:09 $
|
* $Date: 2002/07/26 22:51:50 $
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
*
|
*
|
||||||
*****************************************************************************************
|
*****************************************************************************************
|
||||||
*/
|
*/
|
||||||
package com.ibm.icu.text;
|
package com.ibm.icu.text;
|
||||||
|
|
||||||
|
import com.ibm.icu.impl.UCharacterProperty;
|
||||||
|
|
||||||
import java.text.*;
|
import java.text.*;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
@ -21,7 +23,7 @@ import java.util.Vector;
|
|||||||
* appropriate rule for formatting a particular number and dispatch
|
* appropriate rule for formatting a particular number and dispatch
|
||||||
* control to it, and to arbitrate between different rules when parsing
|
* control to it, and to arbitrate between different rules when parsing
|
||||||
* a number.
|
* a number.
|
||||||
* $RCSfile: NFRuleSet.java,v $ $Revision: 1.3 $ $Date: 2002/02/16 03:06:09 $
|
* $RCSfile: NFRuleSet.java,v $ $Revision: 1.4 $ $Date: 2002/07/26 22:51:50 $
|
||||||
*/
|
*/
|
||||||
final class NFRuleSet {
|
final class NFRuleSet {
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
@ -95,7 +97,7 @@ final class NFRuleSet {
|
|||||||
throw new IllegalArgumentException("Rule set name doesn't end in colon");
|
throw new IllegalArgumentException("Rule set name doesn't end in colon");
|
||||||
} else {
|
} else {
|
||||||
name = description.substring(0, pos);
|
name = description.substring(0, pos);
|
||||||
while (pos < description.length() && Character.isWhitespace(description.
|
while (pos < description.length() && UCharacterProperty.isRuleWhiteSpace(description.
|
||||||
charAt(++pos))) {
|
charAt(++pos))) {
|
||||||
}
|
}
|
||||||
description = description.substring(pos);
|
description = description.substring(pos);
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*
|
*
|
||||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/RuleBasedNumberFormat.java,v $
|
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/RuleBasedNumberFormat.java,v $
|
||||||
* $Date: 2002/07/13 01:36:45 $
|
* $Date: 2002/07/26 22:51:49 $
|
||||||
* $Revision: 1.8 $
|
* $Revision: 1.9 $
|
||||||
*
|
*
|
||||||
*****************************************************************************************
|
*****************************************************************************************
|
||||||
*/
|
*/
|
||||||
@ -14,6 +14,7 @@
|
|||||||
package com.ibm.icu.text;
|
package com.ibm.icu.text;
|
||||||
|
|
||||||
import com.ibm.icu.impl.ICULocaleData;
|
import com.ibm.icu.impl.ICULocaleData;
|
||||||
|
import com.ibm.icu.impl.UCharacterProperty;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.text.FieldPosition;
|
import java.text.FieldPosition;
|
||||||
@ -471,7 +472,7 @@ import java.util.Vector;
|
|||||||
* using these features.</p>
|
* using these features.</p>
|
||||||
*
|
*
|
||||||
* @author Richard Gillam
|
* @author Richard Gillam
|
||||||
* $RCSfile: RuleBasedNumberFormat.java,v $ $Revision: 1.8 $ $Date: 2002/07/13 01:36:45 $
|
* $RCSfile: RuleBasedNumberFormat.java,v $ $Revision: 1.9 $ $Date: 2002/07/26 22:51:49 $
|
||||||
* @see NumberFormat
|
* @see NumberFormat
|
||||||
* @see DecimalFormat
|
* @see DecimalFormat
|
||||||
*/
|
*/
|
||||||
@ -1109,7 +1110,7 @@ public final class RuleBasedNumberFormat extends NumberFormat {
|
|||||||
lpEnd = description.length() - 1;
|
lpEnd = description.length() - 1;
|
||||||
}
|
}
|
||||||
int lpStart = lp + "%%lenient-parse:".length();
|
int lpStart = lp + "%%lenient-parse:".length();
|
||||||
while (Character.isWhitespace(description.charAt(lpStart))) {
|
while (UCharacterProperty.isRuleWhiteSpace(description.charAt(lpStart))) {
|
||||||
++lpStart;
|
++lpStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1191,7 +1192,7 @@ public final class RuleBasedNumberFormat extends NumberFormat {
|
|||||||
while (start != -1 && start < description.length()) {
|
while (start != -1 && start < description.length()) {
|
||||||
// seek to the first non-whitespace character...
|
// seek to the first non-whitespace character...
|
||||||
while (start < description.length()
|
while (start < description.length()
|
||||||
&& Character.isWhitespace(description.charAt(start))) {
|
&& UCharacterProperty.isRuleWhiteSpace(description.charAt(start))) {
|
||||||
++start;
|
++start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user