Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

I find you lack of faith in the forth dithturbing. -- Darse ("Darth") Vader


devel / comp.lang.clipper.visual-objects / Re: Memoline replaces tabs with spaces?

SubjectAuthor
* Memoline replaces tabs with spaces?Grzegorz R.
`- Re: Memoline replaces tabs with spaces?Wolfgang Riedmann

1
Memoline replaces tabs with spaces?

<5c709d09-dd09-47c0-85b1-1577e502de07n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=965&group=comp.lang.clipper.visual-objects#965

  copy link   Newsgroups: comp.lang.clipper.visual-objects
X-Received: by 2002:a05:620a:400d:: with SMTP id h13mr26079801qko.45.1636988010561;
Mon, 15 Nov 2021 06:53:30 -0800 (PST)
X-Received: by 2002:a0c:bf49:: with SMTP id b9mr38341678qvj.53.1636988010339;
Mon, 15 Nov 2021 06:53:30 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.clipper.visual-objects
Date: Mon, 15 Nov 2021 06:53:30 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=79.190.238.18; posting-account=D5fG0goAAADqRXT4F2tZQt5KfDZfW15T
NNTP-Posting-Host: 79.190.238.18
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5c709d09-dd09-47c0-85b1-1577e502de07n@googlegroups.com>
Subject: Memoline replaces tabs with spaces?
From: ramotny64@gmail.com (Grzegorz R.)
Injection-Date: Mon, 15 Nov 2021 14:53:30 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Grzegorz R. - Mon, 15 Nov 2021 14:53 UTC

Hello
I started to bulid a small XLS/ODS table parser using multiline edit field where I paste a copied cell range. CTRL-C/CTRL-V sets TAB chr(9) between each field what is ok.
However wher I read consecutive lines using:
cLine := AllTrim(MemoLine(SELF:oDCmleInput:Value,50,nRow)) where nRow is increasing up to empty(cLine)
then tab character(s) are replaced by space(s).
Is this a normal MemoLine behavour?
Is there a way to stop him doing that i.e. leave chr(9) in line or must I build my own char-by-char/line-by-line parser?
Kind regards
Gregory

Re: Memoline replaces tabs with spaces?

<ivgvq7Fs6qtU1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=967&group=comp.lang.clipper.visual-objects#967

  copy link   Newsgroups: comp.lang.clipper.visual-objects
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: wriedmann@gmail.com (Wolfgang Riedmann)
Newsgroups: comp.lang.clipper.visual-objects
Subject: Re: Memoline replaces tabs with spaces?
Date: Tue, 16 Nov 2021 07:01:41 +0100
Lines: 141
Message-ID: <ivgvq7Fs6qtU1@mid.individual.net>
References: <5c709d09-dd09-47c0-85b1-1577e502de07n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
X-Trace: individual.net r09cHstOqR2tqiyd4I05+Ae7bUTc++Zo+E0Ou4yRX+P/M8aUY=
Cancel-Lock: sha1:i/4XeAxinU2EwPaRxNqQChDI5gM=
User-Agent: XanaNews/1.18.1.6
 by: Wolfgang Riedmann - Tue, 16 Nov 2021 06:01 UTC

Hi Gregory,

the best would be to build your own parser.

Please se below. It may not the best or cleanest code, but it
definitely works for me.

Wolfgang

> I started to bulid a small XLS/ODS table parser using multiline edit
> field where I paste a copied cell range. CTRL-C/CTRL-V sets TAB
> chr(9) between each field what is ok. However wher I read
> consecutive lines using: cLine :=
> AllTrim(MemoLine(SELF:oDCmleInput:Value,50,nRow)) where nRow is
> increasing up to empty(cLine) then tab character(s) are replaced by
> space(s). Is this a normal MemoLine behavour? Is there a way to
> stop him doing that i.e. leave chr(9) in line or must I build my own
> char-by-char/line-by-line parser? Kind regards Gregory

function PasteArrayFromClipboard() as array pascal
local oClipboard as ClipBoard
local aLines as array
local aReturn as array
local nLines as dword
local nLine as dword
local cString as string
local aDetail as array
oClipboard := ClipBoard{}
cString := oClipBoard:RetrieveString()
aLines := String2Lines( cString )
nLines := ALen( aLines )
aReturn := ArrayNew( nLines )
for nLine := 1 upto nLines
aDetail := String2Array( aLines[nLine], _chr( 9 ) )
aReturn[nLine] := aDetail
next
return aReturn

function String2Lines( cString as string ) as array
local aResult as array
local ptrCurrent as byte ptr
local ptrBuffer as byte ptr
local nCurrent as int
local nPrevious as int
local nNext as int
local nI as dword
local nLen as dword
local nCurStart as dword
local cLine as string

nLen := SLen( cString )
ptrBuffer := MemAlloc( nLen + 1 )
Byte( ptrBuffer + nLen ) := 0
MemCopyString( ptrBuffer, cString, nLen )
aResult := {}
ptrCurrent := ptrBuffer
nCurrent := 0
nCurStart := 1
nI := 1
while nI < nLen
nPrevious := nCurrent
nCurrent := Int( Byte( ptrCurrent ) )
if nI < nLen
nNext := Int( Byte( ptrCurrent + 1 ) )
else
nNext := 0
endif
if nCurrent == 13 .and. nNext == 10 // ganz normales CRLF
cLine := SubStr3( cString, nCurStart, nI - nCurStart )
AAdd( aResult, cLine )
ptrCurrent += 2
nCurStart := nI + 2
nI += 2
loop
endif
if nCurrent == 13 .or. nCurrent == 10 // CR oder LF
if ( nPrevious == 13 .or. nPrevious == 10 ) .and. nPrevious !=
nCurrent
// vorheriges Zeichen war auch CR bzw. LF, aber ungleich, also
ignorieren
nCurStart := nI + 1
++ptrCurrent
++nI
loop
endif
cLine := SubStr3( cString, nCurStart, nI - nCurStart )
AAdd( aResult, cLine )
nCurStart := nI + 1
endif
++ptrCurrent
++nI
end

if nCurStart > 0 .and. nCurStart <= nLen // nCurStart > 0 .and.
nCurStart < nLen
cLine := SubStr3( cString, nCurStart, nLen - nCurStart + 1 )
AAdd( aResult, cLine )
endif
MemFree( ptrBuffer )

return aResult
function String2Array( cList as string, cDelimiter as string ) as array
//p String in Array umsetzen
//s
local nPos as dword
local nStart as dword
local nLen as dword
local aList as array
local nLines as dword
local cZeile as string

if SLen( cDelimiter ) == 0
cDelimiter := ","
endif
aList := {}
nStart := 1
nLen := SLen( cDelimiter )
nLines := 0

while ( nPos := At3( cDelimiter, cList, nStart - 1 ) ) > 0
cZeile := Trim( SubStr3( cList, nStart, nPos - nStart ) )
nStart := nPos + nLen
AAdd( aList, cZeile )
++nLines
if nLines % 100 == 0
ApplicationExec( EXECWHILEEVENT )
endif
end
AAdd( aList, Trim( SubStr2( cList, nStart ) ) )

return aList

--

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor