Page 1 of 1

Customize the output list

Posted: Mon Nov 09, 2009 5:45 am
by Haruks
Hello,

Please, see this code:

Code: Select all

  NewList Number()
  
  AddElement(Number())
  Number() = 10
    
  AddElement(Number())
  Number() = 209
    
  AddElement(Number())
  Number() = 30
    
  ForEach Number()
    Debug Number()
  Next
the output will be:
10
209
30
But I need the output to be:
10;209;30
Can you help me?

Re: Customize the output list

Posted: Mon Nov 09, 2009 6:08 am
by citystate
maybe this?

Code: Select all

  NewList Number()
  
  AddElement(Number())
  Number() = 10
    
  AddElement(Number())
  Number() = 209
    
  AddElement(Number())
  Number() = 30
    
  Output$ = ""
  ForEach Number()
    Output$= Output$+Str(Number())+";"
  Next
  Output$ = Left(Output$, Len(Output$)-1)
  Debug Output$

Re: Customize the output list

Posted: Tue Nov 10, 2009 3:58 am
by Haruks
Thanks Citystate!!

Now I will try separate it again... :lol:

----- EDIT ------

Done!! later I will post here the code for separate the "10;209;30".

Thanks for your help Citystate!! :D

Re: Customize the output list

Posted: Tue Nov 10, 2009 6:45 am
by Haruks
I am finishing my code, but i am getting a follow error on the Compiler:
"[COMPILER] Line 150: Bad parameter type, number expected instead of string."
line 150 have the code "Result$ = Chr(ID_ASCII$())" see the code affected:

Code: Select all

  ForEach ID_ASCII$()
    Result$ = Chr(ID_ASCII$())
      AddElement(Pass$())
      Pass$() = Result$
  Next
The list "ID_ASCII$()" have the bellow elements:
112
107
97
181
I was used this code for transform the elements in ASCII to "figure", have other way to do this?

Thanks

Re: Customize the output list

Posted: Tue Nov 10, 2009 7:28 am
by citystate
I think the problem is that ID_ASCII$() is a list of strings (as is indicated by '$') - try changing the variable type of ID_ASCII

Re: Customize the output list

Posted: Fri Nov 13, 2009 3:11 am
by Haruks
Hello,

I can't remove the "$" because that I need merge 2 strings before... the result is added in the list...

Only if have a way to send the a string (for example "String$" that your result is 99 for example, i.e. String$ = 99) and send this to "Example.c"

is possible send the output of a string to a "Character" (.c)?

sorry for my bad English...
Thanks!

Re: Customize the output list

Posted: Fri Nov 13, 2009 3:30 am
by citystate
perhaps something like this?

Code: Select all

  ForEach ID_ASCII$()
    Result$ = Chr(Val(ID_ASCII$()))
      AddElement(Pass$())
      Pass$() = Result$
  Next