KodeGym/Blog Jawa/Acak/String equalsIgnoreCase() Metode ing Jawa
John Squirrels
tingkat
San Francisco

# String equalsIgnoreCase() Metode ing Jawa

Cara equalsIgnoreCase () ing Jawa digunakake kanggo mbandhingake rong senar nalika ora nggatekake bedane cilik (ngisor lan ndhuwur). Kaya metode padha , mbandhingake isi loro strings. Yen isine padha bakal bali bener , utawa palsu .

## Panggunaan

Nalika sampeyan kudu mbandhingake isi senar karo senar liyane nglirwakake sensitivitas cilik.

## Sintaksis

``inputString1.equalsIgnoreCase(inputString2);``
Ing kene isi loro strings inputString1 lan inputString2 dibandhingake karo siji liyane.

## Parameter

Cara iki nampa senar sing dibandhingake karo senar liyane sing diarani metode equalsIgnoreCase () .

## wangsul

Metode equalsIgnoreCase () ngasilake nilai boolean. Yen argumen kasebut ora null lan isine padha, ora nggatekake kasus kasebut, bali bener . Yen ora palsu .

Ayo goleki Program Java kanggo nggambarake metode equalsIgnoreCase () .
``````public class EqualsIgnoreCaseExample {

public static void main(String[] args)
{
String comparisonString1 = "Hello! I am A string";
String comparisonString2 = "heLLo! i AM a STRING";
String comparisonString3 = "Hey there, here's another string to compare the first two.";

System.out.println("Comparison Results");

// see if first 2 comparison strings are equal
boolean result1 = comparisonString2.equalsIgnoreCase(comparisonString1);
System.out.println("comparisonString2 is equal to comparisonString1 = " + result1);

// check if second and third strings match when case ignored
boolean result2 = comparisonString2.equalsIgnoreCase(comparisonString3);
System.out.println("comparisonString2 is equal to comparisonString3 = " + result2);

// check if first and third strings match
boolean result3 = comparisonString3.equalsIgnoreCase(comparisonString1);
System.out.println("comparisonString3 is equal to comparisonString1 = " + result3);
}
}``````

### Output

Comparison Results comparisonString2 padha karo comparisonString1 = bener comparisonString2 padha karo comparisonString3 = false comparisonString3 padha karo comparisonString1 = palsu

## Kesimpulan

Muga-muga saiki sampeyan ngerti carane mbandhingake rong senar tanpa nimbang sensitivitas cilik. Sampeyan bisa tansah nggunakake String equalsIgnoreCase () Metode ing Jawa. Bebas bae kanggo latihan lan bali mrene yen sampeyan butuh pitulung liyane. Sugeng sinau!
Komentar
Sampeyan kudu mlebu kanggo ninggalake komentar
Kaca iki durung duwe komentar