Class: String

Iroha. String

new String()

Source:

Methods

<static> create() → {Iroha.String}

Iroha.String のインスタンスを作って返す。
Source:
Returns:
Iroha.String の新規インスタンス
Type
Iroha.String

<static> guid() → {Iroha.String}

グローバル一意識別子を得る。
Source:
Returns:
作成したグローバル一意識別子を保持している Iroha.String インスタンス
Type
Iroha.String

<static> random(num, chars) → {Iroha.String}

ランダムな文字列を得る。
Parameters:
Name Type Argument Default Description
num number <optional>
24 ランダム文字列の長さ
chars string <optional>
ランダム文字列を構成する文字群
Source:
Returns:
作成したランダム文字列を保持している Iroha.String インスタンス
Type
Iroha.String

abs2rel(base) → {Iroha.String}

絶対パス(URL)を相対パス(URL)へ変換する。
Parameters:
Name Type Description
base string 相対パス(URL)の起点となる場所を絶対パス(URL)で示したもの
Source:
Returns:
このインスタンス自身
Type
Iroha.String
Example
 Iroha.String(      '/path/to/target/').abs2rel('/path/to/base/'      ).get() -> '../target/'
 Iroha.String('http://path/to/target/').abs2rel('http://path/to/base/').get() -> '../target/'

contains(str) → {boolean}

現在の文字列が指定文字列を含んでいれば true を返す。
Parameters:
Name Type Description
str string 検索文字列
Source:
Returns:
現在の文字列が指定文字列を含んでいれば true。
Type
boolean

decodeURI(bool) → {Iroha.String}

%エスケープされた文字列を元に戻す。"decodeURI" か "decodeURIComponent" を使用している。
Parameters:
Name Type Argument Default Description
bool boolean <optional>
false true の場合, "decodeURIComponent" で変換。それ以外は "decodeURI" で変換。
Source:
Returns:
このインスタンス自身
Type
Iroha.String

encodeURI(bool) → {Iroha.String}

文字列を%エスケープに変換する。"encodeURI" か "encodeURIComponent" を使用している。
Parameters:
Name Type Argument Default Description
bool boolean <optional>
false true の場合, "encodeURIComponent" で変換。それ以外は "encodeURI" で変換。
Source:
Returns:
このインスタンス自身
Type
Iroha.String

endsWith(str) → {boolean}

現在の文字列が指定文字列で終わっていれば true を返す。
Parameters:
Name Type Description
str string 検索文字列
Source:
Returns:
現在の文字列が指定文字列で終わっていれば true。
Type
boolean

format(arg1, argN) → {Iroha.String}

簡易フォーマッタ。現在の文字列を指定の形式へ整形する。
Parameters:
Name Type Argument Description
arg1 string | Array.<string> | Object 文字列、または文字列の入っている配列、または文字列をプロパティ値とする連想配列。
argN string <optional>
文字列(2個目以降)
Source:
Returns:
このインスタンス自身
Type
Iroha.String
Example
 Iroha.String('${0}HOGE${1}FUGA${2}').format(    'xxx', '  yyy',   'zzz'  ).get()
 Iroha.String('${0}HOGE${1}FUGA${2}').format([   'xxx',   'yyy',   'zzz' ]).get()
 Iroha.String('${A}HOGE${B}FUGA${C}').format({ A:'xxx', B:'yyy', C:'zzz' }).get()
 Iroha.String('${A}HOGE${B.C}FUGA${B.D.E}').format({ A: 'xxx', B: { C:'yyy', D: { E:'zzz' } } }).get()
     -> 'xxxHOGEyyyFUGAzzz'

get() → {string}

現在の文字列を取得する。
Source:
Returns:
現在の文字列を取得
Type
string

getAfter(str, include, longMatch) → {Iroha.String}

指定の文字列より後ろの部分の文字列を得る。
Parameters:
Name Type Argument Description
str string 検索文字列
include boolean <optional>
true の場合、戻値は検索文字列自身を含む。
longMatch boolean <optional>
true の場合、最長一致で探す。
Source:
Returns:
このインスタンス自身
Type
Iroha.String

getBefore(str, include, longMatch) → {Iroha.String}

指定の文字列より前の部分の文字列を得る。
Parameters:
Name Type Argument Description
str string 検索文字列
include boolean <optional>
true の場合、戻値は検索文字列自身を含む。
longMatch boolean <optional>
true の場合、最長一致で探す。
Source:
Returns:
このインスタンス自身
Type
Iroha.String

init(value) → {Iroha.String}

初期化
Parameters:
Name Type Argument Default Description
value number <optional>
"" 処理対象とする文字列。
Source:
Returns:
このインスタンス自身
Type
Iroha.String

isMatch(str) → {boolean}

現在の文字列が指定文字列と完全に一致するなら true を返す。
Parameters:
Name Type Description
str string 検索文字列
Source:
Returns:
現在の文字列が指定文字列と完全に一致するなら true。
Type
boolean

rel2abs(base) → {Iroha.String}

相対パス(URL)を絶対パス(URL)へ変換する。
Parameters:
Name Type Description
base string 相対パス(URL)の起点となる場所を絶対パス(URL)で示したもの
Source:
Returns:
このインスタンス自身
Type
Iroha.String
Example
 Iroha.String('../target/').rel2abs('/path/to/base/'      ).get() -> '/path/to/target/'
 Iroha.String('../target/').rel2abs('http://path/to/base/').get() -> 'http://path/to/target/'

replace(find, replace) → {Iroha.String}

文字列置換。 String#replace をインスタンス内で実施。
Parameters:
Name Type Description
find string | RegExp 検索文字列、または正規表現
replace string | Function 置換文字列
Source:
Returns:
このインスタンス自身
Type
Iroha.String

sanitize() → {Iroha.String}

文字列を「サニタイズ」する。
Source:
Returns:
このインスタンス自身
Type
Iroha.String

startsWith(str) → {boolean}

現在の文字列が指定文字列から始まっていれば true を返す。
Parameters:
Name Type Description
str string 検索文字列
Source:
Returns:
現在の文字列が指定文字列から始まっていれば true。
Type
boolean

toString() → {string}

現在の文字列を取得する。 IE8 で、 toString メソッドをオーバーライドできない様子。 正確には、jQuery.extend が悪さをしている可能性がある。 ともかく Iroha.String#toString を呼び出すと IE8 でエラーになるようになってしまった。
Source:
Returns:
現在の文字列を取得
Type
string

trim(chars, from, ellipsis) → {Iroha.String}

指定文字数で裁ち落とし処理する。
Parameters:
Name Type Argument Default Description
chars number <optional>
this.length トリミング後の目標文字数。
from string <optional>
"start" トリミング方式。目標文字数を先頭末尾どちらから数えるかの指定。 "start":末尾側裁ち落とし, "end": 先頭側裁ち落とし, "both": 中間裁ち落とし。
ellipsis string <optional>
"\u2026" トリミングで文字が断ち切られる際につける省略記号。デフォルトは "…"。
Source:
Returns:
このインスタンス自身
Type
Iroha.String