We are moved to new domain
Click -> www.ehowtonow.com
Friday, 8 May 2015

Remove the particular character from string

Following example shows, how to remove particular character from string.
Sample Program
package com.javatutorialcorner.javastring;

public class RemoveCharacter {

    public static void main(String[] args) {
        String input = "This is Java String example program";
        int position = 5;
        String result = input.substring(0, position)
                + input.substring(position + 1);

        System.out.println("Input String : " + input);
        System.out.println("Result String : " + result);

    }

}

Result
The above code will produce the following result.

Input String : This is Java String example program
Result String : This s Java String example program

Shop and help us

Flipkart Offer Snapdeal offer Amazon.in offer Amazon.com offer
  • Blogger Comments
  • Facebook Comments
  • Disqus Comments

0 comments:

Post a Comment

Item Reviewed: Remove the particular character from string Rating: 5 Reviewed By: eHowToNow