LANG-1300: fixed formatting on CharSequenceUtils.java

This commit is contained in:
MarkDacek 2017-03-06 18:44:25 -05:00
parent c7c424fb9c
commit a8f41ec97d
1 changed files with 22 additions and 23 deletions

View File

@ -75,23 +75,22 @@ public class CharSequenceUtils {
if (start < 0) { if (start < 0) {
start = 0; start = 0;
} }
if(searchChar < Character.MIN_SUPPLEMENTARY_CODE_POINT){ if (searchChar < Character.MIN_SUPPLEMENTARY_CODE_POINT) {
for (int i = start; i < sz; i++) { for (int i = start; i < sz; i++) {
if (cs.charAt(i) == searchChar) { if (cs.charAt(i) == searchChar) {
return i; return i;
} }
} }
} }
//supplementary characters (LANG1300)
//supplementary characters if (searchChar <= Character.MAX_CODE_POINT) {
if(searchChar <= Character.MAX_CODE_POINT){ char[] chars = Character.toChars(searchChar);
char[] chars = Character.toChars(searchChar); for (int i = start; i < sz; i++) {
for(int i = start; i < sz; i++){ if (cs.charAt(i) == chars[0]) {
if(cs.charAt(i) == chars[0]){ if (i + 1 == sz) {
if(i+1 == sz){
break; break;
} }
if(cs.charAt(i+1) == chars[1]){ if (cs.charAt(i + 1) == chars[1]) {
return i; return i;
} }
} }
@ -141,23 +140,23 @@ public class CharSequenceUtils {
if (start >= sz) { if (start >= sz) {
start = sz - 1; start = sz - 1;
} }
if(searchChar < Character.MIN_SUPPLEMENTARY_CODE_POINT){ if (searchChar < Character.MIN_SUPPLEMENTARY_CODE_POINT) {
for (int i = start; i >= 0; --i) { for (int i = start; i >= 0; --i) {
if (cs.charAt(i) == searchChar) { if (cs.charAt(i) == searchChar) {
return i; return i;
} }
} }
} }
//supplementary characters (LANG1300)
if(searchChar <= Character.MAX_CODE_POINT){ if (searchChar <= Character.MAX_CODE_POINT) {
char[] chars = Character.toChars(searchChar); char[] chars = Character.toChars(searchChar);
for(int i = start; i >= 0; --i){ for (int i = start; i >= 0; --i) {
if(cs.charAt(i) == chars[0]){ if (cs.charAt(i) == chars[0]) {
if(i + 1 == cs.length()){ if (i + 1 == cs.length()) {
break; break;
} }
if(cs.charAt(i+1) == chars[1]){ if (cs.charAt(i + 1) == chars[1]) {
return i; return i;
} }
} }
} }