728x90 AdSpace

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
Annamalai Thangaraj

Annamalai is working as Technical Lead in Leading Telecom company with 5+ years experience in Identity and Access Management , Telecom and Networks, BigData, Java, Spring, Struts, Hibernate, AngularJS, and Enterprise Web Application Development.

Website: Java Tutorials Corner

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: Annamalai Thangaraj