• Post Reply Bookmark Topic Watch Topic
  • New Topic

Change '/' in filename

 
ralph michelsen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Javaranchers
I have a problem with my filename when creating a new BufferedWriter. Please view the following codesnippet:
String fileName = "c:/temp//LEMVIGBANEN, VEMB-LEMVIG-THYBOR´┐ŻN JERNBANE A/S_20030402_1.XML";
Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName),"ISO-8859-1"));
In the filename which is "LEMVIGBANEN, VEMB-LEMVIG-THYBOR´┐ŻN JERNBANE A/S_20030402_1.XML"
there is a '/' which I want the application to ignore as a part of the file path. This '/' is a part of the filename and not the path.
Now, I know that I can change this manually in the String, but does anyone know if there is a standard Java class/method I kan use in order to fix my problem. Someone must have had the same problem as me at some time
Regards
Ralph Michelsen
 
Greg Charles
Sheriff
Posts: 3010
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you get a file with that name? According to my version of Windows (XP), file names cannot contain . I imagine that's also true of earlier versions of Windows, definitely DOS, and as far as I know UNIX as well.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!