textstream.js

来自「JsDoc Toolkit 是一个把js描述格式化成文档的工具。开发者只需按Js」· JavaScript 代码 · 共 41 行

JS
41
字号
/**	@constructor*/JSDOC.TextStream = function(text) {	if (typeof(text) == "undefined") text = "";	text = ""+text;	this.text = text;	this.cursor = 0;}JSDOC.TextStream.prototype.look = function(n) {	if (typeof n == "undefined") n = 0;		if (this.cursor+n < 0 || this.cursor+n >= this.text.length) {		var result = new String("");		result.eof = true;		return result;	}	return this.text.charAt(this.cursor+n);}JSDOC.TextStream.prototype.next = function(n) {	if (typeof n == "undefined") n = 1;	if (n < 1) return null;		var pulled = "";	for (var i = 0; i < n; i++) {		if (this.cursor+i < this.text.length) {			pulled += this.text.charAt(this.cursor+i);		}		else {			var result = new String("");			result.eof = true;			return result;		}	}	this.cursor += n;	return pulled;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?