Remove First Letter From String Using Java

In this tutorial, learn how to remove first letter of the string using java. The short answer is: use substring() of java with 1 as the argument. Java removes the first character from a string and actually generates the new string.

If you have a symbol in the string first letter, you can use java substring function to remove it. However, the function actually does not remove character but generates a new string. The new string comes without the first letter of the old string.

How to Remove First Letter From String Using Java

To remove the first letter from the string. Use the below code contains the old string and the new string. The old string contains the first letter as a symbol ‘&’. The new string is without the first letter ‘&’.

Output

The old string is: &My string is this.
The new string after removal is: My string is this.

The above example gives the output without the first character of the string. It prints both the old string and the new string as the output of the code given above.

However, you can change the string and the output as per your requirement. In addition to the above, you can remove more than one string characters using the java substring(). To remove more letters from the string, you have to increase the value as an argument of the substring().

Hope, you like this tutorial of how to remove first letter of the string using java. If you have any query regarding the tutorial, please comment below.

Also tell me, which method are you using to remove the first letter of the string using java programming language.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.