VikR0001
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2018
02:39 PM
label = Substitute(...) Error?
Why is this line showing a flag in the IDE for wrong syntax?
label = Substitute("Watch Now {1}", "$1.99")
4 REPLIES 4
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2018
03:35 PM
Re: label = Substitute(...) Error?
Indexes begin at 0. So try
label = Substitute("Watch Now {0}", "$1.99")
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2018
03:37 PM
Re: label = Substitute(...) Error?
https://sdkdocs.roku.com/display/sdkdoc/Global+String+Functions#GlobalStringFunctions-Substitute(strasString,arg0asString,arg1=%22%22asString,arg2=%22%22asString,arg3=%22%22asString)asString
Substitute(str as String, arg0 as String, arg1 = "" as String, arg2 = "" as String, arg3 = "" as String) as String
Replaces all instances of {0} or ^0 in str with arg0. Similarly, replaces all instances of {1} or ^1 with arg1, {2} or ^2 with arg2, and {3} or ^3 with arg3.
Example
Substitute(str as String, arg0 as String, arg1 = "" as String, arg2 = "" as String, arg3 = "" as String) as String
Replaces all instances of {0} or ^0 in str with arg0. Similarly, replaces all instances of {1} or ^1 with arg1, {2} or ^2 with arg2, and {3} or ^3 with arg3.
Example
thing = "book"
color = "red"
print Substitute("My {0} is {1}.", thing, color) ' prints "My book is red."
VikR0001
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2018
04:47 PM
Re: label = Substitute(...) Error?
I tried:
...but Eclipse still is flagging a syntax error.
BUT the code side-loads and runs fine on Roku!
Could this be a bug in the Eclipse plugin for Roku?
label = Substitute("Watch Now {0}", "$1,99")
...but Eclipse still is flagging a syntax error.
BUT the code side-loads and runs fine on Roku!
Could this be a bug in the Eclipse plugin for Roku?
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2018
05:09 PM
Re: label = Substitute(...) Error?
If the code works sideloaded in Roku without any errors then yes, I think eclipse isn't updated to return the correct status.