Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
setSlash$
#1
One function to set the direction of your slashes for the proper OS.  It's just that simple.  Wink

Code: (Select All)
foo$ = "./mydir/foo.txt"
Print foo$
Print setSlash$(foo$)
foo2$ = ".\mydir\foo.txt"
Print foo2$
Print setSlash$(foo2$)
foo3$ = "./mydir\foo.txt"
Print foo3$
Print setSlash$(foo3$)

Function setSlash$ (text$)
    temp$ = text$
    $If WIN Then
        desiredSlash$ = "\"
        badSlash$ = "/"
    $Else
            desiredSlash$ ="/"
            badSlash$ = "\"
    $End If
    Do
        p = InStr(temp$, badSlash$)
        If p Then Mid$(temp$, p, 1) = desiredSlash$
    Loop Until p <= 0
    setSlash$ = temp$
End Function
Reply




Users browsing this thread: 1 Guest(s)