Backslash versus foreslash
#5
To extend that theme, and to exaggerate a little bit to be clear as possible:

Code: (Select All)
DIM slosh AS STRING, pichan AS LONG
$IF WIN THEN
slosh = "\"
$ELSE
slosh = "/"
$END IF
pichan = _LOADIMAGE("." + slosh + "a" + slosh + "directory" + slosh + "with" + slosh + "forward" + slosh + "slashes", 32)

Could also write a simple search-and-replace routine that uses "MID$()" LHS for one character:

Code: (Select All)
DIM slosh AS STRING, mypath AS STRING
$IF WIN THEN
slosh = "\"
$ELSE
slosh = "/"
$END IF
mypath = ".|a|directory|with|forward|slashes"
ReplaceString mypath, "|", slosh
pichan = _LOADIMAGE(mypath, 32)

Pipe symbol is special to shell so cannot be used in a filename neither in Linux nor Windows. On MacOS, who knows? Maybe Fifi could tell us.

Note: I didn't include the subprogram because I don't have it with me at the moment. I have another one which works differently, ie. for search and replace strings of different lengths and therefore it doesn't use "MID$()" command.
Reply


Messages In This Thread
Backslash versus foreslash - by TerryRitchie - 01-10-2023, 05:40 PM
RE: Backslash versus foreslash - by SMcNeill - 01-10-2023, 06:21 PM
RE: Backslash versus foreslash - by mnrvovrfc - 01-10-2023, 06:34 PM
RE: Backslash versus foreslash - by Fifi - 01-11-2023, 05:20 AM
RE: Backslash versus foreslash - by SMcNeill - 01-10-2023, 06:43 PM
RE: Backslash versus foreslash - by TerryRitchie - 01-10-2023, 06:50 PM
RE: Backslash versus foreslash - by SMcNeill - 01-10-2023, 06:54 PM
RE: Backslash versus foreslash - by TerryRitchie - 01-10-2023, 07:17 PM
RE: Backslash versus foreslash - by mdijkens - 01-11-2023, 08:24 AM
RE: Backslash versus foreslash - by DSMan195276 - 01-11-2023, 09:38 PM
RE: Backslash versus foreslash - by DSMan195276 - 01-11-2023, 10:15 PM
RE: Backslash versus foreslash - by mnrvovrfc - 01-12-2023, 02:12 AM
RE: Backslash versus foreslash - by TerryRitchie - 01-12-2023, 05:16 AM
RE: Backslash versus foreslash - by Fifi - 01-14-2023, 07:59 AM
RE: Backslash versus foreslash - by TerryRitchie - 01-16-2023, 03:53 AM



Users browsing this thread: 8 Guest(s)