sk_sarkar
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2015
01:47 AM
String to Integer conversion
Hi, facing a problem here in core part of brightscript. like, str = "1234567891000" , and @console typing print str.toInt() and getting Output as 2147483647 though type Integer. Why? :?:
4 REPLIES 4

Komag
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2015
02:07 AM
Re: String to Integer conversion
I've been blinded! :shock: 8-) Please use more normal colors, better for our eyes.
As to the problem, I can't help, sorry
As to the problem, I can't help, sorry

NewManLiving
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2015
02:49 AM
Re: String to Integer conversion
Your conversion has exceeded the maximum size of an integer, being the value it has returned.
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
mramim
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2021
05:14 PM
Re: String to Integer conversion
not sure why i remained stuck on this for a long time but you can call toInt() function on your strings to convert strings to int.
Reference:
https://developer.roku.com/docs/references/brightscript/interfaces/ifstringops.md#toint-as-integer
sanity-check
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2021
02:55 AM
Re: String to Integer conversion
It's too big to be an int - BS has a 'long' but there's no "toLong" method.
Weirdly this works:
parseJson("1234567891000")
...that'll return a numeric value of type 'LongInteger'
[edit]Oh wow, only just noticed this is a thread dredged up from 2015, oops.