diff --git a/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java b/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java index 6d1403bdd..1d97e5568 100644 --- a/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java +++ b/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java @@ -75,23 +75,22 @@ public class CharSequenceUtils { if (start < 0) { start = 0; } - if(searchChar < Character.MIN_SUPPLEMENTARY_CODE_POINT){ - for (int i = start; i < sz; i++) { - if (cs.charAt(i) == searchChar) { - return i; - } - } + if (searchChar < Character.MIN_SUPPLEMENTARY_CODE_POINT) { + for (int i = start; i < sz; i++) { + if (cs.charAt(i) == searchChar) { + return i; + } + } } - - //supplementary characters - if(searchChar <= Character.MAX_CODE_POINT){ - char[] chars = Character.toChars(searchChar); - for(int i = start; i < sz; i++){ - if(cs.charAt(i) == chars[0]){ - if(i+1 == sz){ + //supplementary characters (LANG1300) + if (searchChar <= Character.MAX_CODE_POINT) { + char[] chars = Character.toChars(searchChar); + for (int i = start; i < sz; i++) { + if (cs.charAt(i) == chars[0]) { + if (i + 1 == sz) { break; } - if(cs.charAt(i+1) == chars[1]){ + if (cs.charAt(i + 1) == chars[1]) { return i; } } @@ -141,23 +140,23 @@ public class CharSequenceUtils { if (start >= sz) { start = sz - 1; } - if(searchChar < Character.MIN_SUPPLEMENTARY_CODE_POINT){ + if (searchChar < Character.MIN_SUPPLEMENTARY_CODE_POINT) { for (int i = start; i >= 0; --i) { if (cs.charAt(i) == searchChar) { return i; } } } - - if(searchChar <= Character.MAX_CODE_POINT){ + //supplementary characters (LANG1300) + if (searchChar <= Character.MAX_CODE_POINT) { char[] chars = Character.toChars(searchChar); - for(int i = start; i >= 0; --i){ - if(cs.charAt(i) == chars[0]){ - if(i + 1 == cs.length()){ - break; + for (int i = start; i >= 0; --i) { + if (cs.charAt(i) == chars[0]) { + if (i + 1 == cs.length()) { + break; } - if(cs.charAt(i+1) == chars[1]){ - return i; + if (cs.charAt(i + 1) == chars[1]) { + return i; } } }