moji
Version:
半角全角変換・特定文字抽出など日本語を便利に扱うJavaScriptライブラリ。
47 lines (39 loc) • 881 B
JavaScript
function mojiStr() {
/**
* trim
* 行頭、行末の空白を削除
*/
this.trim = function () {
this._result = this._result.trim();
return this;
};
/**
* match
* matchした文字列に変更
* matchしなければなにもしない
* @param {RegExp} regexp
*/
this.match = function(regexp) {
var result = this._result.match(regexp);
if (!result || !regexp) return this;
this._result = result.toString();
return this;
};
this.replace = function(regexp, new_str) {
this._result = this._result.replace(regexp, new_str);
return this;
};
return this;
}
module.exports = mojiStr;
// slice
//substr
//toLocaleLowerCase
//toLocaleUpperCase
//toLowerCase
//toUpperCase
//trim
//trimLeft
//trimRight
//encodeURIComponent
//decodeURIComponent