本文整理汇总了Java中com.ibm.icu.text.Replaceable类的典型用法代码示例。如果您正苦于以下问题:Java Replaceable类的具体用法?Java Replaceable怎么用?Java Replaceable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Replaceable类属于com.ibm.icu.text包,在下文中一共展示了Replaceable类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: ReplaceableUCharacterIterator
import com.ibm.icu.text.Replaceable; //导入依赖的package包/类
/**
* Public constructor
* @param replaceable text which the iterator will be based on
*/
public ReplaceableUCharacterIterator(Replaceable replaceable){
if(replaceable==null){
throw new IllegalArgumentException();
}
this.replaceable = replaceable;
this.currentIndex = 0;
}
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:12,代码来源:ReplaceableUCharacterIterator.java
示例2: handleTransliterate
import com.ibm.icu.text.Replaceable; //导入依赖的package包/类
@Override
protected void handleTransliterate(Replaceable text, Position pos, boolean incremental) {
String source = text.toString();
String target = ENHANCEMENTS.containsKey(source)
? ENHANCEMENTS.get(source)
: HAN_TO_PINYIN.transliterate(source);
text.replace(pos.start, pos.limit, target);
pos.start = text.length();
pos.limit = text.length();
}
开发者ID:ranmocy,项目名称:MonkeyTree,代码行数:12,代码来源:Transliterators.java
示例3: parsePattern
import com.ibm.icu.text.Replaceable; //导入依赖的package包/类
/**
* Parse a pattern string within the given Replaceable and a parsing
* pattern. Characters are matched literally and case-sensitively
* except for the following special characters:
*
* ~ zero or more Pattern_White_Space chars
*
* If end of pattern is reached with all matches along the way,
* pos is advanced to the first unparsed index and returned.
* Otherwise -1 is returned.
* @param pat pattern that controls parsing
* @param text text to be parsed, starting at index
* @param index offset to first character to parse
* @param limit offset after last character to parse
* @return index after last parsed character, or -1 on parse failure.
*/
public static int parsePattern(String pat,
Replaceable text,
int index,
int limit) {
int ipat = 0;
// empty pattern matches immediately
if (ipat == pat.length()) {
return index;
}
int cpat = Character.codePointAt(pat, ipat);
while (index < limit) {
int c = text.char32At(index);
// parse \s*
if (cpat == '~') {
if (PatternProps.isWhiteSpace(c)) {
index += UTF16.getCharCount(c);
continue;
} else {
if (++ipat == pat.length()) {
return index; // success; c unparsed
}
// fall thru; process c again with next cpat
}
}
// parse literal
else if (c == cpat) {
int n = UTF16.getCharCount(c);
index += n;
ipat += n;
if (ipat == pat.length()) {
return index; // success; c parsed
}
// fall thru; get next cpat
}
// match failure of literal
else {
return -1;
}
cpat = UTF16.charAt(pat, ipat);
}
return -1; // text ended before end of pat
}
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:67,代码来源:Utility.java
示例4: formatInput
import com.ibm.icu.text.Replaceable; //导入依赖的package包/类
/**
* Convenience method.
*/
public static String formatInput(Replaceable input,
Transliterator.Position pos) {
return formatInput((ReplaceableString) input, pos);
}
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:8,代码来源:UtilityExtensions.java
注:本文中的com.ibm.icu.text.Replaceable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论