| Author |
especial characters
|
Fernando Dominguez
Ranch Hand
Joined: Sep 01, 2006
Posts: 93
|
|
Hello I would like to get a String value will be ="C:\file.txt"; DocumentacionCategoriaDto documentacionCategoriaDto= documentacionCategoriaModel.getDocumento(idDocumento); ruta = documentacionCategoriaDto.getRutaDoc() + "\\" + documentacionCategoriaDto.getNombreDoc(); System.out.println(ruta); By this way compiler doesn't complain System.out shows C:\file.txt But debbuger says that ruta's value is "c:\\file.txt" if I only use "\" eclipse complains. Howe can I get C:\file.txt Thanks
|
 |
Gavin Tranter
Ranch Hand
Joined: Jan 01, 2007
Posts: 333
|
|
Certain charactors in a string have special meaning, and are called escape charactors, to create these escape charactors a \ is used thus, if you wish to use \ in a string you most escape it, making: \\ thus c:\\file.txt will be printed on screen as c:\file.txt you could also try using unix like seprators ie c:/file.txt [ June 19, 2007: Message edited by: Gavin Tranter ] [ June 19, 2007: Message edited by: Gavin Tranter ]
|
 |
Sasha Ruehmkorf
Ranch Hand
Joined: Mar 29, 2007
Posts: 115
|
|
I don't see the problem with your solution, but you could also try: [ June 19, 2007: Message edited by: Sasha Ruehmkorf ]
|
 |
 |
|
|
subject: especial characters
|
|
|