Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Remove some particular character from a String

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 502
    Comment on it

    Sometime, we need to remove or replace some particular character from a String.

    Below is the method by which we can accomplish this. I am using replaceAll() method of the String.

    replaceAll() have two parameter as an arguments. First one is the list of character that you want to replace and second is the string that you want to be replace with.


    String  name = Ja(v_)-a; 
    name = name.replaceAll([-)_(],); 
    System.out.println(New String : +name); 

    O/P: New String :Java
    Exception is ^ character cannot be the first character of the list.
    Hope it will help you.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: