Java Code Examples for com.ibm.icu.text.Transliterator#Position

The following examples show how to use com.ibm.icu.text.Transliterator#Position . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UtilityExtensions.java    From fitnotifications with Apache License 2.0 5 votes vote down vote up
/**
 * For debugging purposes; format the given text in the form
 * aaa{bbb|ccc|ddd}eee, where the {} indicate the context start
 * and limit, and the || indicate the start and limit.
 */
public static String formatInput(ReplaceableString input,
                                 Transliterator.Position pos) {
    StringBuffer appendTo = new StringBuffer();
    formatInput(appendTo, input, pos);
    return com.ibm.icu.impl.Utility.escape(appendTo.toString());
}
 
Example 2
Source File: UtilityExtensions.java    From fitnotifications with Apache License 2.0 5 votes vote down vote up
/**
 * For debugging purposes; format the given text in the form
 * aaa{bbb|ccc|ddd}eee, where the {} indicate the context start
 * and limit, and the || indicate the start and limit.
 */
public static StringBuffer formatInput(StringBuffer appendTo,
                                       ReplaceableString input,
                                       Transliterator.Position pos) {
    if (0 <= pos.contextStart &&
        pos.contextStart <= pos.start &&
        pos.start <= pos.limit &&
        pos.limit <= pos.contextLimit &&
        pos.contextLimit <= input.length()) {

        String  b, c, d;
        //a = input.substring(0, pos.contextStart);
        b = input.substring(pos.contextStart, pos.start);
        c = input.substring(pos.start, pos.limit);
        d = input.substring(pos.limit, pos.contextLimit);
        //e = input.substring(pos.contextLimit, input.length());
        appendTo.//append(a).
            append('{').append(b).
            append('|').append(c).append('|').append(d).
            append('}')
            //.append(e)
            ;
    } else {
        appendTo.append("INVALID Position {cs=" +
                        pos.contextStart + ", s=" + pos.start + ", l=" +
                        pos.limit + ", cl=" + pos.contextLimit + "} on " +
                        input);
    }
    return appendTo;
}
 
Example 3
Source File: UtilityExtensions.java    From fitnotifications with Apache License 2.0 4 votes vote down vote up
/**
 * Convenience method.
 */
public static String formatInput(Replaceable input,
                                 Transliterator.Position pos) {
    return formatInput((ReplaceableString) input, pos);
}
 
Example 4
Source File: UtilityExtensions.java    From fitnotifications with Apache License 2.0 4 votes vote down vote up
/**
 * Convenience method.
 */
public static StringBuffer formatInput(StringBuffer appendTo,
                                       Replaceable input,
                                       Transliterator.Position pos) {
    return formatInput(appendTo, (ReplaceableString) input, pos);
}