/// <summary> /// 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. /// </summary> /// <param name="appendTo"></param> /// <param name="input"></param> /// <param name="pos"></param> /// <returns></returns> 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 - pos.ContextStart); // ICU4N: Corrected 2nd parameter c = input.Substring(pos.Start, pos.Limit - pos.Start); // ICU4N: Corrected 2nd parameter d = input.Substring(pos.Limit, pos.ContextLimit - pos.Limit); // ICU4N: Corrected 2nd parameter //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); }
/// <summary> /// 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. /// </summary> /// public static StringBuilder FormatInput(StringBuilder 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); }