filePro tip -- edits
Brian K. White
brian at aljex.com
Wed Aug 22 12:01:41 PDT 2007
I'll answer only with some obvious questions. What happens to:
* multiple leading spaces (my edit-illiterate guess, to stop this case from
putting comma at begining)
* multiple trailing spaces
* field with only one word , at beginning, at end, multiple spaces both
sides
* empty field
* space-filled field
Have not tested it.
Brian K. White brian at aljex.com http://www.myspace.com/KEYofR
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx Linux SCO FreeBSD #callahans Satriani Filk!
----- Original Message -----
From: "Kenneth Brody" <kenbrody at bestweb.net>
To: "filePro mailing list" <filepro-list at lists.celestial.com>
Sent: Wednesday, August 22, 2007 1:34 PM
Subject: filePro tip -- edits
>I recently had someone ask me for a solution to this problem:
>
> A file is being imported which contains a field which contains
> multiple spaces between words, which need to be shrunk to a
> single space.
>
> I suggested an edit:
>
> 1space { (" " [{!" "!}]) | * }
>
>
> It turned out that the field was a name field, and was actually
> in last name, first name format, and it needed a comma after the
> last name. Unfortunately, the names themselves may contain
> spaces, so inserting a comma before the first space is not an
> option. (Also, the first name did not always start in the same
> column, so MID was not an option, either.)
>
> The following will insert a comma before any set of multiple
> spaces, and condense any whitespace to a single space:
>
> ln_fn { {!" "!}@ | ( <, > !" "! [{!" "!}] ) | * }
>
> I leave it as an exercise for the reader to determine why this edit
> needs the {!" "!}@ at the beginning. Bonus points for answering
> correctly without actually testing the edit without it. :-)
>
> --
> +-------------------------+--------------------+-----------------------+
> | Kenneth J. Brody | www.hvcomputer.com | #include |
> | kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
> +-------------------------+--------------------+-----------------------+
> Don't e-mail me at: <mailto:ThisIsASpamTrap at gmail.com>
>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>
More information about the Filepro-list
mailing list