String클래스의 boolean startsWith(String prefix)

BB·2023년 11월 28일

String클래스의 boolean starts With(String prefix);

  • prefix로 시작되는 문자열일 시 true아니면 false

    String str = "Hello, World!"
    
    boolean startsWithHello = str.startsWith("Hello"); 
    boolean startsWithHi = str.startsWith("Hi");
    
    System.out.println(startsWithHello); //true
    System.out.println(startsWithHi); //false

0개의 댓글