• Post Reply Bookmark Topic Watch Topic
  • New Topic

'\' in String  RSS feed

 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having problem that , I am reading a properties file wich contains some paths.like
JAVA_HOME=C:\Test
But once u use the getProperty("JAVA_HOME"); it gives C:Test \ is not taken.but if it is \\ Or / it is reading.What to do for this.
 
Joe Ess
Bartender
Posts: 9439
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either use \\ or /. The '\' indicates an escape character, like '\n' for newline, '\a' for the bell or '\\' for single backslash. The Java IO classes will interpret forward slashes the same as the single backslash escape character.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!