FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse - extractline - speed
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
xBrowse - extractline - speed
Posted: Wed Sep 15, 2010 03:04 PM

function ExtractLine( cText, nFrom )

I found out that if I use instead of
nAt := At( CRLF, SubStr( cText, nFrom ) )

nAt := At( CRLF, cText, nFrom )

the speed of the function is much better. Is it save to remove SubStr here?

Thanks in advance
Otto

function ExtractLine( cText, nFrom )
local cLine, nAt

nAt := At( CRLF, SubStr( cText, nFrom ) )

if nAt > 0
cLine := Substr( cText, nFrom, nAt - 1 )
nFrom += nAt + 1
else
cLine := Substr( cText, nFrom )
nFrom := Len( cText ) + 1
endif

return cLine

//----------------------------------------------------------------------------//

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse - extractline - speed
Posted: Wed Sep 15, 2010 03:30 PM
Is it save to remove SubStr here?

Yes in xHarbour.
This extended syntax is not supported by Harbour ( to my knowledge )
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion