0

In my "container bound" SlidesApp using script I have a need to compare strings and have no idea how to do it. For example, I find the text inside one of my shapes:

shapes[i].getText().asString();

So, now I need to see if it contains a "needle" in it. E.g. if the text in my shape is "This is a brown fox", and the needle is "brown", then I get a condition that the script can respond to.

if (shapes[i].getText().asString() <contains> needle)
{
  // do something
}

But there is nothing I can find in references that explains which methods and which classes I should be looking for.

a1s2d3f4
  • 589
  • 4
  • 7
  • 18

1 Answers1

0
if (shapes[i].getText().asString().indexOf("needle") !== -1) {
  // do something
}
Grant Timmerman
  • 414
  • 5
  • 9