Customize the output list

Just starting out? Need help? Post your questions and find answers here.
User avatar
Haruks
User
User
Posts: 30
Joined: Wed Sep 23, 2009 1:41 am
Location: Brasil (Brazil)

Customize the output list

Post 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?
=D
citystate
Enthusiast
Enthusiast
Posts: 638
Joined: Sun Feb 12, 2006 10:06 pm

Re: Customize the output list

Post 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$
there is no sig, only zuul (and the following disclaimer)

WARNING: may be talking out of his hat
User avatar
Haruks
User
User
Posts: 30
Joined: Wed Sep 23, 2009 1:41 am
Location: Brasil (Brazil)

Re: Customize the output list

Post 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
=D
User avatar
Haruks
User
User
Posts: 30
Joined: Wed Sep 23, 2009 1:41 am
Location: Brasil (Brazil)

Re: Customize the output list

Post 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
=D
citystate
Enthusiast
Enthusiast
Posts: 638
Joined: Sun Feb 12, 2006 10:06 pm

Re: Customize the output list

Post 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
there is no sig, only zuul (and the following disclaimer)

WARNING: may be talking out of his hat
User avatar
Haruks
User
User
Posts: 30
Joined: Wed Sep 23, 2009 1:41 am
Location: Brasil (Brazil)

Re: Customize the output list

Post 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!
=D
citystate
Enthusiast
Enthusiast
Posts: 638
Joined: Sun Feb 12, 2006 10:06 pm

Re: Customize the output list

Post by citystate »

perhaps something like this?

Code: Select all

  ForEach ID_ASCII$()
    Result$ = Chr(Val(ID_ASCII$()))
      AddElement(Pass$())
      Pass$() = Result$
  Next
there is no sig, only zuul (and the following disclaimer)

WARNING: may be talking out of his hat
Post Reply