FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour encoding from array
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
encoding from array
Posted: Fri Feb 26, 2016 12:19 PM
I must take the numbers at n position of plinestring array

for z= 1 or 2 or 3 it run ok
for z= 4 make error ( return the wrong numbers) why ?


Code (fw): Select all Collapse
#include "fivewin.ch"

function test()
Local aline[3]
Local nposition[5]
Local nLine
Local nNumbers [5]
Local plinestring[4]
local z,k,n
local nCol

aline[1]:= {1,3,6,7,1}
aline[2]:= {3,1,6,1,9}
aline[3]:= {9,3,1,7,9}

plinestring[1]:="bbbbb"
plinestring[2]:="aaaaa"
plinestring[3]:="ccccc"
plinestring[4]:="abcba"


z:=4

       nposition[1]:= substr(plinestring[z],1,1)
       nposition[2]:= substr(plinestring[z],2,1)
       nposition[3]:= substr(plinestring[z],3,1)
       nposition[4]:= substr(plinestring[z],4,1)
       nposition[5]:= substr(plinestring[z],5,1)


    //  xbrowser  nposition

For k= 1 to 5   // numeri
       For n= 1 to 5  //position
           nCol:= k
     If nposition[n]= "a"
          nline:= 1
       elseif nposition[n]= "b"
          nline:= 2
       elseif nposition[n]= "c"
          nline:= 3
       endif



   nNumbers[k]:=  aline[nline] [nCol]

next
nCol:= 0
nline:= 0
next


  xbrowser  nNumbers

  return nil


if z= 1 return 3,1,6,1,9 ok
if z= 2 return 1,3,6,7,1 ok
if z= c return 9,3,1,7,9 ok
if z= 4 return 99999 bad why ? ( it must return me 11111)
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: encoding from array
Posted: Fri Feb 26, 2016 03:07 PM

Silvio,

I don't see the problem you are seeing. When I run it I get 1,3,6,7,1 not 9,9,9,9,9.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: encoding from array
Posted: Sat Feb 27, 2016 09:12 AM

sorry ,
also 1,3,6,7,1 is bad

if the z= 4 must return me 11111

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: encoding from array
Posted: Sat Feb 27, 2016 09:28 AM

perhaps I found the error

For k= 1 to 5 // numeri

 If nposition[k]= alltrim("a")
      nline:= 1
   elseif nposition[k]= alltrim("b")
      nline:= 2
   elseif nposition[k]= alltrim("c")
      nline:= 3
   endif


      nNumbers[k]:=  aline[nline][k]

next k

nopw seem to run ok

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion