添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

The compareToIgnoreCase(String str) method in Java compares two strings lexicographically, ignoring case differences.

Syntax

Let us see the syntax,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public class StudyopediaDemo {
public static void main ( String args [ ] ) {
int value ;
String msg1 = "Welcome to USA!" ;
String msg2 = "Welcome to USA!" ;
String msg3 = "Welcome to Australia!" ;
String msg4 = "Welcome to AUSTRALIA" ;
System . out . println ( "String one: " + msg1 ) ;
System . out . println ( "String two: " + msg2 ) ;
System . out . println ( "String three: " + msg3 ) ;
System . out . println ( "String four: " + msg4 ) ;
value = msg1 . compareToIgnoreCase ( msg2 ) ;
System . out . println ( value ) ;
value = msg2 . compareToIgnoreCase ( msg3 ) ;
System . out . println ( value ) ;
value = msg3 . compareToIgnoreCase ( msg4 ) ;
System . out . println ( value ) ;
}
}

About | Contact | Jobs
Terms | Privacy Policy | Refund Policy | Reviews | Merch | Roadmap | Books