function to supress intermediate spaces

User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: function to supress intermediate spaces

Post by nageswaragunupudi »

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
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: function to supress intermediate spaces

Post by Otto »

Hello,
is this a good and save way to remove CRLF form database-fields.
Thanks in advance
Otto

Code: Select all

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


 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: function to supress intermediate spaces

Post by nageswaragunupudi »

Mr Otto

You just need one line

Code: Select all

        aRec[I] := CharRem( CRLF, aRec[I])
 
All Chr(13) and all Chr(10) will be removed, even if they are not together.

Code: Select all

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
Post Reply