Page 1 of 1

Checking a variable for a substring

Posted: Fri Jun 17, 2016 12:50 pm
by jessican
Hi!

So lets say I have a variable named sunSet which holds the string "overTheHills"

and I want to check the last 5 positions of the string sunSet to see if it holds the word "Hills"

If it does, I want to execute a set of functions, and if it doesn't, I want to do something else..

Is it possible to only check the last specified positions? like starting from the end of the string?

For example if I searched the String "OverHillsThe", I don't want the check to go through..
I want it to be true only if Hills is at the end of the string.

So the "contains" function wouldn't work..

Re: Checking a variable for a substring

Posted: Mon Jun 20, 2016 8:43 am
by FrancescoT

Re: Checking a variable for a substring

Posted: Wed Jun 22, 2016 8:39 am
by jessican
Thanks so much!

Re: Checking a variable for a substring

Posted: Wed Jun 22, 2016 12:54 pm
by FrancescoT
:D :D :D