12 Replies Latest reply on Jun 11, 2015 12:09 AM by Tim Webb

    How to find spaces in a string

    Iftach Priel

      Hi,

      I'm trying to build a dispatch that runs whenever a new file is put in the vault.

      This dispatch will look at the file name, and locate " "(spaces) and "." (dots).

      If spaces and/or dots are found, the user will be prompt to rename the file, or the file will be renamed automatically, replacing spaces and dots with "_" (underscore).

      The reason is that spaces and dots make a mess out of searching, and I rather not having them in file names.


      locating the dots in a string is simple enough, but with spaces it just doesn't work. Under string functions in dispatch variables

      "Find" and "ReverseFind" can't seem to recognize spaces.

       

      The syntax I'm using to find the dots is:

      Find(%FileNameNoExt%, .)

      where %FileNameNoExt% is a variable containing the file name without extension (lots of posts on how to do that).

      Running the dispatch on a file that contains a dot in its name. returns a positive numerical value that represents the location of the dot in the string.

       

      But for "space" it just doesn't work:

      Find(%FileNameNoExt%,  )

      Running the dispatch on a file that contains a space in its name. returns value of -1, which means there are no spaces found.

       

      Is there an encoding of some sort, or a symbol to represent space the way html uses " " ? what would be the syntax of the Find ?

       

       

      Thanks