remove all occurrences of a given character from input String?
Example:
Input: str = "Hello World";
Output: Heo Word
Approach
Java
public class StrRemoveALl {public static void main(String[] args) {String str = "Hello World";str = str.replaceAll("l", "");System.out.println(str);}}
No comments:
Post a Comment