Change the APIs from char to int character input to match underlying JRE API called. There is no need to narrow the input type argument to the JRE, in fact this causes us to loose support for Unicode supplementary characters. The APIs changed are:
- indexOf(String, char) -> indexOf(String, int) - indexOf(String, char, int) -> indexOf(String, int, int) - lastIndexOf(String, char) -> lastIndexOf(String, int) - lastIndexOf(String, char, int) -> lastIndexOf(String, int, int) - contains(String, char) -> contains(String, int) git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@923527 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bc52782cd8
commit
2fdfb4a387
|
@ -746,7 +746,7 @@ public class StringUtils {
|
|||
* -1 if no match or <code>null</code> string input
|
||||
* @since 2.0
|
||||
*/
|
||||
public static int indexOf(String str, char searchChar) {
|
||||
public static int indexOf(String str, int searchChar) {
|
||||
if (isEmpty(str)) {
|
||||
return INDEX_NOT_FOUND;
|
||||
}
|
||||
|
@ -778,7 +778,7 @@ public class StringUtils {
|
|||
* -1 if no match or <code>null</code> string input
|
||||
* @since 2.0
|
||||
*/
|
||||
public static int indexOf(String str, char searchChar, int startPos) {
|
||||
public static int indexOf(String str, int searchChar, int startPos) {
|
||||
if (isEmpty(str)) {
|
||||
return INDEX_NOT_FOUND;
|
||||
}
|
||||
|
@ -1030,7 +1030,7 @@ public class StringUtils {
|
|||
* -1 if no match or <code>null</code> string input
|
||||
* @since 2.0
|
||||
*/
|
||||
public static int lastIndexOf(String str, char searchChar) {
|
||||
public static int lastIndexOf(String str, int searchChar) {
|
||||
if (isEmpty(str)) {
|
||||
return INDEX_NOT_FOUND;
|
||||
}
|
||||
|
@ -1064,7 +1064,7 @@ public class StringUtils {
|
|||
* -1 if no match or <code>null</code> string input
|
||||
* @since 2.0
|
||||
*/
|
||||
public static int lastIndexOf(String str, char searchChar, int startPos) {
|
||||
public static int lastIndexOf(String str, int searchChar, int startPos) {
|
||||
if (isEmpty(str)) {
|
||||
return INDEX_NOT_FOUND;
|
||||
}
|
||||
|
@ -1272,7 +1272,7 @@ public class StringUtils {
|
|||
* false if not or <code>null</code> string input
|
||||
* @since 2.0
|
||||
*/
|
||||
public static boolean contains(String str, char searchChar) {
|
||||
public static boolean contains(String str, int searchChar) {
|
||||
if (isEmpty(str)) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue