Straight quotes and smart (curly) quotes are different characters so your substitute function may be replacing one type and not the other. There is also more than one character that can look like a space so you may have other characters than a simple space in your text.
maybe try to check for ascii characters?
' = the single quote( ' )...
so can i run the Substitute() function and check against ascii values?
Substitute (description ; ["'" ; "-"]) etc...
Try using the Char function. This requires using the unicode for the character instead of ascii. You can also copy the characters that are making it through, pasting it into a text field and use Code ( textfield ) to discover the code.
You may also want to experiment with the Filter command to filter out all characters but a list of accepted characters.
Filter's no good here because i need to replace the spaces in a string with dashes- for readability and SEO
i.e "This is a product 3" wide" will become
Substitute (description ; ["/" ; "-"] ; [" " ; "-"] ; ["&" ; "-"] ;["@ " ; "-"] ;["'" ; "-"] ;["\" " ; "-inch-"] ;["(" ; "-"] ; [")" ; "-"] ;["%" ; "-"] ;["," ; "-"];["#" ; "-"];[";" ; "-"];["=" ; "-"];["'" ; "-"];[""" ; "-"];[Char(32) ; "-"];[Char(34) ; "-inch-"])
good call on the Code() -> Char() trick to find the character value- it helped alot. Decided to replace the phrase "3"" to "3-inch-" for readabilities sake.
posting this solution for future reference. thanks Phil.
Filter's no good here because i need to replace the spaces in a string with dashes-
I'm suggesting you use Filter to omit the unusual extra characters nested inside your substitute function to replace the conventional characters with dashes. This gives you a way to deal with any other non printing characters that may show up in the future instead of having to continually update your substitute function to handle more and more characters.
i think filter() will cause more problems though- it will remove the specified characters from a string rather than replacing them.
if i filter the unusual spaces from this string "this is a string" - it will just become "thisisastring" right?
in PHP i can do this to turn any non-alphanumeric character into a hyphen
Yep, but once you've accounted for all the "most likely" stuff in your substitute function, it might serve as an "insurance policy" to protect you from producing a link that won't work. Hmmm, that means I'd have to reverse things though, and put the substitute function inside the filter function so that identified characters get substituted before the filter function screens out any other characters.
You could even use filter as a "warning flag". After substituting, if the length of the filtered text does not equal the length of the unfiltered text, you've got one or more characters present that your substitute function failed to deal with.
the PHP example is interesting. I can imagine a pretty straight forward recursive custom function that could be creatd with FileMaker Advanced that would do the same--replacing all characters not part of a specified range of values with a specified character. There are web sites where custome functions are shared and a search of them might locate one already written that does this for you.
i'll come back an add it to this thread if i come across one, thanks for thinking through this one