• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

especial characters

 
Ranch Hand
Posts: 111
Eclipse IDE Firefox Browser Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see the problem with your solution, but you could also try:

[ June 19, 2007: Message edited by: Sasha Ruehmkorf ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic