![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
More FM7 upgrade pain. Trim(x) no longer strips carriage returns. What a pain! Is this a bug or intended behaviour? Unlike the GetAsText stuff I posted earlier about, this one apepars to represent a departure from previous versions. Whats the best way to handle it now? For single word entry I can use LeftWords(x,1), but in for multi-word entries all my solutions just get ugly and tedious looking. And for my thinking Trim(x) is a better semantic representation of what I'm doing than Leftwords(x,1) is. (yeah yeah, I'm an aspiring programming language designer in my spare time... ha! what spare time?!) /sigh |
#3
| |||
| |||
|
|
Ummm ... Trim isn't supposed to remove carriage returns, only extra spaces. |
|
Trim Returns the supplied text, stripped of all leading and trailing spaces. |
|
To remove carriage returns you only need to use the Substitute command. ie. Substitute(TextField, ReturnChar, "") |
#4
| |||
| |||
|
|
In article <090720051135139495%helpful_harry (AT) nom (DOT) de.plume.com>, helpful_harry (AT) nom (DOT) de.plume.com says... Ummm ... Trim isn't supposed to remove carriage returns, only extra spaces. Actually removing leading and trailing 'whitespace' is the standard implementation of trim(). Trim Returns the supplied text, stripped of all leading and trailing spaces. Yes. I read the help file, and with all due respect that's a pretty narrow-minded interpretation of trim(). Every other language I've worked with including php, java, c/c++/c#, sql (yeah, most implementations of SQL have Trim), and even FM 3 thru 6 trimmed whitespace, not merely 'spaces' by default. Whitespace includes spaces, tabs, carriage returns, linefeeds, (all non- visible characters). FM7s Trim now only considers -spaces- ?! To remove carriage returns you only need to use the Substitute command. ie. Substitute(TextField, ReturnChar, "") If only it were that simple. What about <tab>? And I'm not confident it can be relied on for all variations of CR/LF, CR, and LF with just your one substitution. Moreover if the field contains: A<space><enter><space>B<space><enter><space The trim funtion should return: A<space><enter><space>B Yours will return A<space><space>B<space The trailing space can be dealt with by wrapping it in Trim... the erroneously deleted return however is not so forgivable. This is a bug,imo. FM3/4/5/6 did it correctly. |
#5
| |||
| |||
|
|
Every other language I've worked with including php, java, c/c++/c#, sql (yeah, most implementations of SQL have Trim), and even FM 3 thru 6 trimmed whitespace, not merely 'spaces' by default. Whitespace includes spaces, tabs, carriage returns, linefeeds, (all non- visible characters). FM7s Trim now only considers -spaces- ?! |
|
This is a bug,imo. FM3/4/5/6 did it correctly. |
#6
| |||
| |||
|
|
I found a cleaner workaround the ugly messes I was trying: MiddleWords(string;1;WordCount(string)) |
#7
| |||
| |||
|
|
42 wrote: I found a cleaner workaround the ugly messes I was trying: MiddleWords(string;1;WordCount(string)) Our messages crossed. See my comments in the last post about leftwords(), as they also apply to middlewords(). |

I've been working on mostly non-FM projects in the last few
, and I've been too lazy to setup
#8
| |||
| |||
|
|
I used to post here a lot under my full name back in... geez... 2000ish. Lynn Allen was around back then, although John Weinshel seems to be gone.. I've been working on mostly non-FM projects in the last fewyears. The 42 thing came around when coworkers/clients/employers found out you could google peoples names... At any rate its nice to be back doing more Filemaker work... but this FM7 stuff really feels half baked in a lot of places. Overall its a big step forward though, despite my numerous vocal complaints. |
#9
| |||
| |||
|
|
In article <090720051135139495%helpful_harry (AT) nom (DOT) de.plume.com>, helpful_harry (AT) nom (DOT) de.plume.com says... Ummm ... Trim isn't supposed to remove carriage returns, only extra spaces. Actually removing leading and trailing 'whitespace' is the standard implementation of trim(). Trim Returns the supplied text, stripped of all leading and trailing spaces. Yes. I read the help file, and with all due respect that's a pretty narrow-minded interpretation of trim(). Every other language I've worked with including php, java, c/c++/c#, sql (yeah, most implementations of SQL have Trim), and even FM 3 thru 6 trimmed whitespace, not merely 'spaces' by default. Whitespace includes spaces, tabs, carriage returns, linefeeds, (all non- visible characters). FM7s Trim now only considers -spaces- ?! |
)|
To remove carriage returns you only need to use the Substitute command. ie. Substitute(TextField, ReturnChar, "") If only it were that simple. What about <tab>? And I'm not confident it can be relied on for all variations of CR/LF, CR, and LF with just your one substitution. Moreover if the field contains: A<space><enter><space>B<space><enter><space The trim funtion should return: A<space><enter><space>B Yours will return A<space><space>B<space The trailing space can be dealt with by wrapping it in Trim... the erroneously deleted return however is not so forgivable. |
|
This is a bug,imo. FM3/4/5/6 did it correctly. |
#10
| ||||
| ||||
|
|
With FileMaker 7's recursive functions you should be able to easily write a function to remove any trailing tabs / carriage returns / spaces by simply checking the last character by using Right(Text, 1) and removing it if it's a whitespace character, and keeping doing that until the last character is a "legal" one. |
|
There may be a plug-in around that adds this "other" Trim function too. |
|
This is a bug,imo. FM3/4/5/6 did it correctly. Nope. See above. Technically removing anything else would be the bug since that's not what FileMaker says it's Trim function does. |
|
The Trim function in both Excel and Claris/AppleWorks actually removes all extra spaces between words (leaving just one) as well as any leading and trailing spaces. Of course, a spreadsheet doesn't have to bother about tabs and carriage returns since you can't put them in a cell. |

![]() |
| Thread Tools | |
| Display Modes | |
| |