Monday 14, Apr 2025
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

Related Posts:

  • String Concatenation in JavaFollowing example shows String concatenation in Java using + operator and StringBuffer.append() method. Sample Programpackage com.javatutorialcorner.javastring;public class StringConcatenation { public static void main(Str… Read More
  • How to check file existence in Java Following example shows how to check file existence using file.exists() method in Java. existspublic boolean exists() Tests whether the file or directory denoted by this abstract pathname exists. Returns:    … Read More
  • How to shuffle the element of collection (List) Following example shows how to shuffle the element of Collection (List) using Collections.shuffle(list); method in Java. void java.util.Collections.shuffle(List<?> list)shufflepublic static void shuffle(List<?> … Read More
  • How to get the size of Collection Following example shows how to get the size of collection using collection.size() method in Java. int java.util.List.size()sizeint size() Returns the number of elements in this list. If this list contains more than Integer.… Read More
  • How to replace the element from List Following example shows how to replace all the occurrence of element with another element using Collections.replaceAll(list, oldVal, newVal) method in Java. <String> boolean java.util.Collections.replaceAll(List<St… Read More
  • Blogger Comments
  • Facebook Comments
  • Disqus Comments

0 comments:

Post a Comment

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