String 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 Worl
String str = "Hello World";
String str2 = str.substring(1,str.length());
String roles = "[This is an example of list.toString()]";
//Below substring method will remove the first and last character of roles String
roles = roles.substring(1, roles.length()-1);
// here roles will become "This is an example of list.toString()"
System.out.println("New String: "+roles);
"Hello World".substring(1) // ello World
String data = "/culo"
data.Remove(0,1);
data.TrimStart('/');
data.Substring(1);
<?php
$str = "geeks";
// Or we can write ltrim($str, $str[0]);
$str = ltrim($str, 'g');
echo $str;
?>
Remove the first or last charachter of a String