skip to main | skip to sidebar

Java Programs and Examples with Output

Pages

▼
 
  • RSS
  • Twitter
Thursday, November 1, 2012

Code to Remove Certain Characters from a Java Input

Posted by Raju Gupta at 3:35 AM – 0 comments
 

Sometimes we can't rename a file automatically when the Filename has "/" inside them because of Windows limitations. This code might prove handy in these situations.

?
1
2
3
4
5
6
7
8
9
//Code to Remove Certain Characters from a Java Input//
 
try {
    String Y = X;
    String regx = "/";
    char[] ca = regx.toCharArray();
    for (char c : ca) {
     Y = Y.replace("" + c, "");
}

Leave a Reply

Newer Post Older Post
Subscribe to: Post Comments ( Atom )
  • Popular
  • Recent
  • Archives
Powered by Blogger.
 
 
 
© 2011 Java Programs and Examples with Output | Designs by Web2feel & Fab Themes

Bloggerized by DheTemplate.com - Main Blogger