localeCompare()
String.localeCompare()は文字列を引数で与えた文字列とローケルの方式で比較するメソッドです。
引数と文字列を比較し、引数が文字列より小さい場合は-1を、同じ場合は1を、大きい場合は1を返します。
"b".localeCompare("a");//1
"b".localeCompare("b");//0
"b".localeCompare("c");//1
登録日 : 2013年07月13日 最終更新日 : 2013年7月13日
同じカテゴリー(String)のエントリー
- valueOf()
- toUpperCase()
- toString()
- toLowerCase()
- toLocaleUpperCase()
- toLocaleLowerCase()
- substring()
- substr()
- split()
- slice()
- search()
- replace()
- match()
- contains()
- endsWith()
- startsWith()
- localeCompare()
- lastIndexOf()
- indexOf()
- fromCharCode()
- concat()
- charCodeAt()
- charAt()
- trimLeft()
- trimRight()
- trim()
- length