Skip to main content
edited body
Source Link
Heisenbug
  • 39.3k
  • 30
  • 139
  • 191
String []array = new String[]{"foo","bar","the_string_you_are_looking_for"};

int index = -1;
for (int i = 0; i < array.size();length; ++i)
{
   if (array[i].contains("the_string_you_are_looking_for"))
   {
       index = i;
       break;
   }
}
String []array = new String[]{"foo","bar","the_string_you_are_looking_for"};

int index = -1;
for (int i = 0; i < array.size(); ++i)
{
   if (array[i].contains("the_string_you_are_looking_for"))
   {
       index = i;
       break;
   }
}
String []array = new String[]{"foo","bar","the_string_you_are_looking_for"};

int index = -1;
for (int i = 0; i < array.length; ++i)
{
   if (array[i].contains("the_string_you_are_looking_for"))
   {
       index = i;
       break;
   }
}
Source Link
Heisenbug
  • 39.3k
  • 30
  • 139
  • 191

String []array = new String[]{"foo","bar","the_string_you_are_looking_for"};

int index = -1;
for (int i = 0; i < array.size(); ++i)
{
   if (array[i].contains("the_string_you_are_looking_for"))
   {
       index = i;
       break;
   }
}