Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

JavaScript: String Tokenization and Substring

// Tokenize a comma-separated string
// then recreate the comma-separated list

  var currentTagTokens = currentTags.split( "," );
  var existingTags = "";

  for ( var i = 0; i < currentTagTokens.length; i++ )
  {
    existingTags = existingTags + currentTagTokens[ i ] + ", ";
  }

  // Remove the trailing ", " from existingTags
  existingTags = existingTags.substring( 0, existingTags.length - 3 ); 

JavaScript String Tokenization

//
// String Tokenization with JavaScript
// From http://www.thescripts.com/forum/thread91795.html
//

function makeArray( strLongString )
{
  return strLongString.split( "," );
}
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS