Re: searching through an array of strings?

If you mean how to search each entry in the array to see if it contains a phrase or character then yes there is.
I realized after posting that I should've commented this out to explain what I'm doing.
//This declares the array of type string called arrayString and gives it 5 empty entries.
string[] arrayString(5);
//The following 5 lines stores a string within the array in a unique entry.
arrayString[0]="Hi my name is George.";
arrayString[1]="Hi my name is Alex.";
arrayString[2]="Hi my name is Diana.";
arrayString[3]="Hi my name is Bobbie";
arrayString[4]="Hi my name is Lewis";
//This creates a loop through arrayString and checks each entry for the characters 'diana', I don't recall if the string_contains function is case sensitive or not. It then returns the string that contains the text. You can manipulate this easily enough to return the location of the character in the string as well as the entire string.
for(int x=0; x<arrayString.length; x++)
{
if(-1<string_contains(arrayString[x], "Diana", 1))
{
return arrayString[x];
}
}
Hope this helps!

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : sneak via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : sneak via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : sneak via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : sneak via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : sneak via Audiogames-reflector

Reply via email to