src/js/qrcode.js
function _getTypeNumber(sText, nCorrectLevel) {			
		var nType = 1;
		var length = _getUTF8Length(sText);
		
		for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) {
			var nLimit = 0;
			
			switch (nCorrectLevel) {
				case QRErrorCorrectLevel.L :
					nLimit = QRCodeLimitLength[i][0];
					break;
				case QRErrorCorrectLevel.M :
					nLimit = QRCodeLimitLength[i][1];
					break;
				case QRErrorCorrectLevel.Q :
					nLimit = QRCodeLimitLength[i][2];
					break;
				case QRErrorCorrectLevel.H :
					nLimit = QRCodeLimitLength[i][3];
					break;
			}
			
			if (length <= nLimit) {
				break;
			} else {
				nType++;
			}
		}
		
		if (nType > QRCodeLimitLength.length) {
			throw new Error("Too long data");
		}
		
		return nType;
	}
function _getTypeNumber(sText, nCorrectLevel) {			
		var nType = 1;
		var length = _getUTF8Length(sText);
		
		for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) {
			var nLimit = 0;
			
			switch (nCorrectLevel) {
				case QRErrorCorrectLevel.L :
					nLimit = QRCodeLimitLength[i][0];
					break;
				case QRErrorCorrectLevel.M :
					nLimit = QRCodeLimitLength[i][1];
					break;
				case QRErrorCorrectLevel.Q :
					nLimit = QRCodeLimitLength[i][2];
					break;
				case QRErrorCorrectLevel.H :
					nLimit = QRCodeLimitLength[i][3];
					break;
			}
			
			if (length <= nLimit) {
				break;
			} else {
				nType++;
			}
		}
		
		if (nType > QRCodeLimitLength.length) {
			throw new Error("Too long data");
		}
		
		return nType;
	}
function _getTypeNumber ( sText , nCorrectLevel ) { var nType = 1 ; var length = _getUTF8Length ( sText ) ; for ( var i = 0 , len = QRCodeLimitLength . length ; i <= len ; i ++ ) { var nLimit = 0 ; switch ( nCorrectLevel ) { case QRErrorCorrectLevel . L : nLimit = QRCodeLimitLength [ i ] [ 0 ] ; break ; case QRErrorCorrectLevel . M : nLimit = QRCodeLimitLength [ i ] [ 1 ] ; break ; case QRErrorCorrectLevel . Q : nLimit = QRCodeLimitLength [ i ] [ 2 ] ; break ; case QRErrorCorrectLevel . H : nLimit = QRCodeLimitLength [ i ] [ 3 ] ; break ; } if ( length <= nLimit ) { break ; } else { nType ++ ; } } if ( nType > QRCodeLimitLength . length ) { throw new Error ( "Too long data" ) ; } return nType ; }
Get the type by string length

@private
@param {String} sText
@param {Number} nCorrectLevel
@return {Number} type
Get the type by string length