getTokenArray function
Implementation
List<String> getTokenArray(
String text
)
{
var tokenArray = <String>[];
var characterIndex = 0;
while ( characterIndex < text.length )
{
if ( text[ characterIndex ] == '\\' )
{
if ( characterIndex + 1 < text.length )
{
tokenArray.add( text.substring( characterIndex, characterIndex + 2 ) );
characterIndex += 2;
}
else
{
tokenArray.add( text[ characterIndex ] );
++characterIndex;
}
}
else
{
var postCharacterIndex = characterIndex;
while ( postCharacterIndex < text.length
&& text[ postCharacterIndex ] != '\\' )
{
++postCharacterIndex;
}
tokenArray.add( text.substring( characterIndex, postCharacterIndex ) );
characterIndex = postCharacterIndex;
}
}
return tokenArray;
}