Chip:

Thanks for posting this code. I can use that if I do the "crawl through the
records".

Since Pat's from the UK, does it left-justify the text?  ;-)



--
Douglas von Roeder
949-336-2902

On Wed, Sep 21, 2016 at 2:56 PM, Chip Scheide <4d_o...@pghrepository.org>
wrote:

> Doug,
> if I am reading this correctly
> (http://kb.4d.com/resources/inug?msgid=GmailId14980bbd87790d18
> ) -
> Keisuke is saying...
>
> SET TEXT TO PASTEBOARD($text)
> $text:=Get text from pasteboard
>
> apply to your text field(s)
>
>
>
> Also I found this on game (12 years ago - from Pat Bensky)
>
> Here is some code to strip gremlins. You might not need some bits -
> e.g.,
> the removal of leading and trailing spaces.
>
>   ` GremlinsRemove
>   ` 29/01/02 pb
>   ` Deletes "gremlins" from text -- e.g.
>   ` embedded tabs, spaces at beg. or end, line ends etc.
>   ` parameters: $1 = pointer to the data to be checked
>   ` (could be a field or variable)
>
> C_TEXT($text;$tOutput)
> C_LONGINT($i;$length;$type)
>
> $type:=Type($1->)
>
> If (($type=Is Text ) | ($type=Is Alpha Field ) | ($type=Is String Var ))
> If (Length($1->)>0)
> $text:=$1->
>
>   ` first remove leading spaces
> While (Ascii($text¾1„)=32)
> $text:=Substring($text;2)
> End while
>
>   ` then remove all trailing spaces
> While (Ascii($text¾Length($text)„)=32)
> $text:=Substring($text;1;Length($text)-1)
> End while
>
>
>   ` Then remove all embedded gremlins
>   ` Nothing below ASCII 32 (space) should be allowed, except
>   ` 13 (CR) but only in text, not strings
> $length:=Length($text)
> $tOutput:=""
> For ($i;1;$length)
> Case of
> : (($type=Is Text ) & (Ascii($text¾$i„)=13))  ` this is
> allowed
> $tOutput:=$tOutput+$text¾$i„
>
> : (Ascii($text¾$i„)=13)
> $tOutput:=$tOutput+" "
>
> : (Ascii($text¾$i„)<32)
>   ` not allowed
> Else
> $tOutput:=$tOutput+$text¾$i„
> End case
> End for
>
> $1->:=$tOutput
> End if   ` length > 0
> End if   ` type = text or string
>
>
> On Wed, 21 Sep 2016 14:19:14 -0700, Douglas von Roeder wrote:
> > I've hit a situation in a legacy application that has records with alpha
> > and text fields that contain numerous non-printing characters. The
> > non-printing characters are causing non-printing.
> >
> > How do I go about finding the records the have invalid characters and
> > deleting the Char(0)?
> >
> > One approach would be Query by formula checking to see if the position of
> > Char(0)>0 but that seems to be a painfully resource intensive approach.
> >
> > Another tack would be to update the trigger code but that means I only
> get
> > cleaned up data if the record is modified.
> >
> > Thoughts, comments, suggestions, etc. on this issue are welcome.
> >
> > --
> > Douglas von Roeder
> > 949-336-2902
> > **********************************************************************
> > 4D Internet Users Group (4D iNUG)
> > FAQ:  http://lists.4d.com/faqnug.html
> > Archive:  http://lists.4d.com/archives.html
> > Options: http://lists.4d.com/mailman/options/4d_tech
> > Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> > **********************************************************************
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************
>
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to