How to make Use of String startswith and equalsIgnoreCase for string array object
I have to place selected particular set of string from String Array into an开发者_StackOverflow社区other array, here I need to combine both equalsIgnorecase
with String startsWith
method.
If I have comparator:
String a= "j";
if(a.startswith("j"))
it returns true only "j", but here i need "J" and "j" has case sensitive, how can I get this.
Thanks in advance.
if("j".equalsIgnoreCase(a.substring(0, 1)))
I think what you want to do is this.
String a = "Joker";
if((a.substring(0,1)).equalsIgnoreCase("j")) doSomething();
精彩评论