How can I easily clean out stray carriage returns from careless entry?
I am using 8.5. Find/replace does not accept a carriage return.
Open a text editor (like TextEdit on mac) and key in a carriage return. Select the return and copy it.
Switch to FMP and select Edit>Find/Replace and paste in the return character.
Use trim and substitute functions.
Use the paragraph character: ¶ (for substitute)
substitute(fieldName ; '¶¶' ; '¶')
or whatever you need to remove.
In answer to your question about TextEdit, in a new document, key in one carriage return (it will be invisible but the cursor will move to the next line).
Select all and copy.
This places the return character on the clipboard ready to be pasted into the Find/Replace dialog.
if in FMP 10... you can use Code function to retrieve the ASCII value of a each individual character (10 = LF or enter key, 13 = CR or carriange return), if Code (char) = 12 or 13 drop the character.
in psdudo code would look along these lines...
$var to contents of field
$length to length of $var
$counter = 1
$currentchar = middle ( $var ; $counter ; 1)
$ASCIIVal = Code ( $currentchar )
if ( $ASCIIVal not = 10 or $ASCIIVal not = 13 )
$newvar = $currentchar
$counter = $counter + 1
exit if $coutner = $var (might need > instead of = here, test it)
replace field contents with $newvar
this said... substitute as mentioned above would be your first point, and if doesnt work properly, try this one...
Retrieving data ...