Answers for "check if string ends with java"

1

check if string ends with .

var str = "Hello world, welcome to the universe.";
var n = str.endsWith("universe.");
Posted by: Guest on May-01-2021
0

how to check the end of a string java

public class Demo {
    public static void main(String[] args) {
       String str = "demo";
       if(str.endsWith("mo")) {
          System.out.println("The string ends with the word mo");
       } else {
          System.out.println("The string does not end with the word mo");
       }
    }
}
Posted by: Guest on July-04-2020

Code answers related to "check if string ends with java"

Browse Popular Code Answers by Language