coercion to a number

Ken Ray kray at sonsothunder.com
Mon Sep 19 00:32:09 EDT 2005


On 9/18/05 7:46 PM, "Daniel Wenger" <DanielWenger at worldnet.att.net> wrote:

> I have a string "@0123@". If I strip the @ char how do I then make
> 0123 into a number? I know that I can take each char in the string
> and interpret it and build the number up with powers of ten, but I am
> hoping that Revolution has the method built in.

Yes, you can simply add 0 to it and it will be a number, as in:

  put "@123@" into tNum   -- string
  replace "@" with "" in tNum   -- string
  put tNum + 0 into tNum   -- number

HTH,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list