nl_tokens: Replaces unescaped symbols in <code > str< / code > . For example the $ symbol will be replaced in item$count but not in item \ $count .
pl_tokens: function ( str , symbol , replace ) { var i = 0 ; var il = str . <mask> ; var sl = symbol . length ; var matchCount = 0 ; while ( i < il ) { if ( str . charAt ( i ) == '\\' ) { // escaped symbol, skip next character i += sl + 1 ; } else if ( str . substr ( i , sl ) == symbol ) { // have match var curSl = sl ; matchCount ++ ; var newValue = replace ; if ( _ . isFunction ( replace ) ) { var replaceData = replace ( str , symbol , i , matchCount ) ; if ( replaceData ) { curSl = replaceData [ 0 ] . length ; newValue = replaceData [ 1 ] ; } else { newValue = false ; } } if ( newValue === false ) { // skip replacement i ++ ; continue ; } str = str . substring ( 0 , i ) + newValue + str . substring ( i + curSl ) ; // adjust indexes il = str . length ; i += newValue . length ; } else { i ++ ; } } return str ; }