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
Code Example |
---|
Java :: run java from terminal |
Java :: java intent extras |
Java :: JsonArray get first Object |
Java :: the main of java |
Java :: set toolbar background color android |
Java :: java php object |
Java :: convert array to string in java |
Java :: Date(Long) to integer and back |
Java :: java actionevent |
Java :: integer to binary java |
Java :: mockito Unable to make protected final java.lang.Class |
Java :: hashmap get value by key java |
Java :: reverse java |
Java :: get index of element in array java |
Java :: get spring application context |
Java :: reversing the linked list |
Java :: Employee Java. |
Java :: print a list java |
Java :: isEmpty java code |
Java :: hashmap |
Java :: java access a file |
Java :: Float to bytes java |
Java :: stringbuilder java |
Java :: kruskal java |
Java :: Java How to use Queue? |
Java :: how to send http post create request using curl command |
Java :: sorting methods in java |
Java :: cookie jsf |
Java :: video compression with java |
Java :: int[] java |