
squirreltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2013
08:36 AM
String Ops
I have searched and am unable to find something like this.
Is it possible to look for a certain string within a string?
Sort of like:
string = "123xyz567"
if string contains "xyz"
do something
end if
Thanks
Is it possible to look for a certain string within a string?
Sort of like:
string = "123xyz567"
if string contains "xyz"
do something
end if
Thanks
Kinetics Screensavers
5 REPLIES 5

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2013
08:42 AM
Re: String Ops
You're looking for InStr: http://sdkdocs.roku.com/display/sdkdoc/ ... gAsInteger
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)

squirreltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2013
08:49 AM
Re: String Ops
Thank you theEndless, i looked at that and don't see any "compare" or "contains' type items there. None of the things there are defined, so i could be missing it or just be dense. Which one will do this?
edit ok i see your whole URL now, but i dont see how the As Integer part works
Thanks
edit ok i see your whole URL now, but i dont see how the As Integer part works
Thanks
Kinetics Screensavers

squirreltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2013
08:58 AM
Re: String Ops
if str.Instr("xyz") As integer ) As integer
I'm not seeing how this could be true or false which is what i need.
if str.Instr("xyz") ) = true
I'm not seeing how this could be true or false which is what i need.
if str.Instr("xyz") ) = true
Kinetics Screensavers

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2013
09:08 AM
Re: String Ops
8.5 Instr(start As Integer, text As String, substring As String) As Integer
Returns the position of the first instances of substring within text, starting at the specified start position. Returns 0 if the substring is not found. The first position is 1.
So anything greater than zero means the string was found:
if Instr(str, "xyz") > 0 then
Found()
else
NotFound()
end if
The stringops version works the same except indexes are zero-based so -1 is the "not found" case:
if str.Instr("xyz") >= 0 then
Found()
else
NotFound()
end if
--Mark

squirreltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2013
09:20 AM
Re: String Ops
Thank you Mark, I got it now. All this stuff seems impossible when you don't know, and easy when you do.
thanks again.
thanks again.
Kinetics Screensavers