FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour function to supress intermediate spaces
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: function to supress intermediate spaces
Posted: Fri Jan 30, 2015 05:15 AM
This is only available with xHarbour though?

Both Harbour and xHarbour.

We need to link \xharbour\lib\ct.lib for xHarbour and \harbour\lib\hbct.lib for Harbour.
If we are using fwh, it means we already have these libs included in our link scripts though we might not have noticed.

These libs contain all function of the erstwhile CA-Tools.
Regards



G. N. Rao.

Hyderabad, India
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: function to supress intermediate spaces
Posted: Sat Jan 31, 2015 10:23 AM
Hello,
is this a good and save way to remove CRLF form database-fields.
Thanks in advance
Otto
Code (fw): Select all Collapse
select daten
aStruc := DBStruct()
go top
do while .not. eof()
    aRec := getrec()

    For I := 1 to len( aRec )
        if aStruc[I,2] = "C"
        aRec[I] := CharRem( CHR(10), aRec[I])
        aRec[I] := CharRem( CHR(13), aRec[I] ) 
        endif
    next
    
    select daten
    rlok()
    saverec( aRec )
    unlok()
    skip

enddo
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: function to supress intermediate spaces
Posted: Sat Jan 31, 2015 12:40 PM
Mr Otto

You just need one line

Code (fw): Select all Collapse
        aRec[I] := CharRem( CRLF, aRec[I])


All Chr(13) and all Chr(10) will be removed, even if they are not together.

Code (fw): Select all Collapse
select daten
aFldNo := {}
AEval( DbStruct(), { |a,i| If( a[ 2 ] $ 'CM', AAdd( aFldNo, i ), nil ) } )
if .not. Empty( aFldNo )
   go top
   do while .not. eof()
      rlok()
      for each i in aFldNo
         FieldPut( i, CharRem( CRLF, FieldGet( i ) ) )
      next
      DBUNLOCK()
      skip
   enddo
endif
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion