Following example shows, how to remove particular character from string.
Sample Program
Result
The above code will produce the following result.
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




0 comments:
Post a Comment