🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #18861

Backslash Escape Character

#18861
From: Jack Frosch
Date: Wed, 08 Apr 1998 00:00
33 lines
1483 bytes
I'm wanting to concatenate a filename string to a directory string, both
of which came from a Filer selection.  For instance,

//*******************************************
String   sFileDir, sFileName;

dlg_File = new Filer(this, "Select File");
dlg_File.show();

sFileDir       = dlg_File.getDirectory();
sFileName   = dlg_File.getFile();

if (sFileName.length() > 0)
// Sidebar:  Is this the best way to check if a file was selected?
  {
   sle_FilePath.setText(sFileDir + "\\" + sFileName);        // show
path+file in Field control  <---Line13
   File  hdlFile = new File(sFileDir, sFileName);
   // do something with File
   }
//*******************************************

Unfortunately, the resulting text in sle_FilePath looks like:
"c:\winnt\temp\\file.txt"  If I change the expression in Line 13 to
(sFileDir + "\" + sFileName), the compiler chokes, saying I have an
unclosed quote.

So how do I add a backslash string to another string?

TIA.

Jack
Technical Details
Message-ID: <352C344C.18E9FBFD@swbell.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,5f23d90b3c517ba1,start
X-Google-Attributes: gidf74b3,public
From: Jack Frosch <jfrosch@swbell.net>
Subject: Backslash Escape Character
Date: 1998/04/08
Message-ID: <352C344C.18E9FBFD@swbell.net>
X-Deja-AN: 342280668
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language