ts-jsdk
Version:
TypeScript implementation of the Java platform
21 lines • 565 B
JavaScript
export class StringTokenizer {
constructor(str, delimiter = " ") {
this.tokens = [];
this.currentIndex = 0;
this.tokens = str.split(delimiter);
}
hasMoreTokens() {
return this.currentIndex < this.tokens.length;
}
nextToken() {
if (this.hasMoreTokens()) {
const token = this.tokens[this.currentIndex];
this.currentIndex++;
return token;
}
else {
throw new Error("No more tokens");
}
}
}
//# sourceMappingURL=StringTokenizer.js.map