2 Replies Latest reply on Feb 18, 2014 11:52 AM by med

    using substitute on a text with slashes

    med

      Title

      using substitute on a text with slashes

      Post

           i am am using the function get(desktoppath) and this is resulting in /c:/users/med/dsktop/

           Then I am trying to use substitute to replace desktop with downloads

           Apparently all these slashes are causing problems because the substitute is not replacing anything.

           I tried substitute($desktop;"desktop";"downloads") where $desktop is the variable holding the desktop path

           and tried substitute($desktop;"/desktop";"/downloads")

           and tried substitute($desktop;"\/";"-") as an intermediate step

           nothing seems to be substituting any thing, so what am I doing wrong

        • 1. Re: using substitute on a text with slashes
          philmodjunk

               and this is resulting in /c:/users/med/dsktop/

               is dsktop a typo or is it really returing dsktop. I will assume that this is a typo and that you are really getting: /c:/users/med/desktop/

               If I read you correctly, you want to use this to get: /c:/users/med/downloads/

               You should be able to use Substitute ( $Desktop ; "desktop" ; "downloads" )

               You shouldn't need to substitute any / characters. But if you are really getting dsktop, then you need to use:

               Substitute ( $Desktop ; "desktp" ; "downloads" )

               please note that subsitute is case sensitive so if your text has desktop, you can't refer to "Desktop" in your substitute function call and get "desktop" replaced with other text.

          • 2. Re: using substitute on a text with slashes
            med

                 Thank you, the last statement you wrote had the key "case sensitive" because actually the result was /C;/Users/med/Desktop/

                 and I ignored that because in all other parts of filemaker like comparisons and finds, case is ignored.

                 I converted the result to lower case and then used substitute and it works now.