java remove first character from string

Java
var str = "Hello";
var newString = str.substring(0, str.length - 1); //newString = HellString string = "Hello World";

//Remove first character
string.substring(1); //ello World

//Remove last character
string.substring(0, string.length()-1); //Hello Worl

//Remove first and last character
string.substring(1, string.length()-1); //ello Worlprivate static String removeLastChar(String str) {
    return str.substring(0, str.length() - 1);
}
Source

Also in Java: