Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Manipulating & Set Default 1

Status
Not open for further replies.

itflash

Programmer
Jul 18, 2001
535
GB

Hi all

I have a routine that displays the contents of directories and sub directories and uses the "SET DEFAULT" command.

All works fine until the user makes a directory with a " or a '

This causes a problem for my string routines, which think it is the termination of a string. But I need to use the ' (see code below) to take account of long filenames.

Any way around this?

Thanks
ITflash


PS: Code is as follow:
todo="SET DEFAULT TO ('" + ALLTRIM(newpath) + "')"
&todo




 
The double qoute mark (") is not allowed as a character in a folder name. Therefore, you should be able to just swap your single quotes (') and double quotes (") in your existing expression and it sould work correctly.

NewPath = "c:\A 'Test' folder"
todo='SET DEFAULT TO ("' + ALLTRIM(l_x) + '")'
&todo
 
oops, yes you are right.
Sometimes you get lost in the code.


Thanks for the reply.


ITflash
[thumbsup2]
 
Name expressions" are another reliable way to solve this problem:

Code:
lcName = [Johnny "The Bear" O'Conner]+' [B]'
SET MESSAGE TO (lcName)
* or:
lcDir = [C:\Data\O'Connel]
SET DEFAULT TO (lcDir)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top