check last character of string code example
Example 1: javascript get last character in string
var hello = "Hello World";
var lastCharOfHello=hello.slice(-1);//d
Example 2: check last character of string java
String str = "India";
System.out.println("last char = " + str.charAt(str.length() - 1));