“Tokenize JavaScript” Code-Antworten

JavaScript explodieren

//split into array of strings.
var str = "Well, how, are , we , doing, today";
var res = str.split(",");
Grepper

Tokenize JavaScript

var text = "This is a short text about StackOverflow.";
var stopwords = ['this'];

var words = text.split(/\W+/).filter(function(token) {
    token = token.toLowerCase();
    return token.length >= 2 && stopwords.indexOf(token) == -1;
});

console.log(words); // ["is", "short", "text", "about", "StackOverflow"]
Muhammad Rizki Purba

Ähnliche Antworten wie “Tokenize JavaScript”

Fragen ähnlich wie “Tokenize JavaScript”

Weitere verwandte Antworten zu “Tokenize JavaScript” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen