Re: Creating a sequence from integers

new topic     » goto parent     » topic index » view thread      » older message » newer message

Rich Klender wrote:
> 
> This is probably very basic but it's stumping me.
> 
> Lets say I have the following:
> 
> integer x
> integer y
> 
> x=1
> y=1
> 
> What I want is to combine them in the sequence {11}.  Can I just do this by
> assigning them to a variable:
> 
> sequence combined = {xy}

To join arbitary sized integers, this might be what you're after ...

  -- Convert to strings and concatenate them
  combined = sprintf("%d", x) & sprintf("%d", y)
  -- Convert the combined string into an integer
  combined = value(combined)
  -- Extract the resulting integer and place it in a sequence
  combined = {integer(combined[2])} -- this might fail if result is too big

  -- Thus x=12 and y=9876 gives {129876}

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu