Skip to content

Instantly share code, notes, and snippets.

@lionelB
Created August 23, 2012 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lionelB/3438501 to your computer and use it in GitHub Desktop.
Save lionelB/3438501 to your computer and use it in GitHub Desktop.
Get index of string
protected function getIndexesOf(word : String, source : String = "") : Vector.<int>
{
var results : Vector.<int> = new Vector.<int>();
var startIndex : int = source.indexOf( word, 0 );
while( startIndex != -1 )
{
results.push(startIndex);
startIndex = source.indexOf( word, startIndex + word.length );
}
return results;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment