JavaScript 文字列操作 新しいページはコチラ
提供: yonewiki
(→文字コード変換(1文字→ISO Latin-1コード) charCodeAt) |
(→文字コード変換(1文字→ISO Latin-1コード) charCodeAt) |
||
| 412行: | 412行: | ||
== '''文字コード変換(1文字→ISO Latin-1コード) charCodeAt ''' == | == '''文字コード変換(1文字→ISO Latin-1コード) charCodeAt ''' == | ||
| − | * | + | *strData15.charCodeAt("@akairo_no_sora",1) |
| 420行: | 420行: | ||
*第一引数:変換したい文字を含む文字列 | *第一引数:変換したい文字を含む文字列 | ||
*第二引数:ISO Latein-1に変換したい文字のポジション | *第二引数:ISO Latein-1に変換したい文字のポジション | ||
| + | |||
| + | |||
| + | |||
| + | サンプルスクリプト | ||
| + | <syntaxhighlight lang="javascript" line start="1"> | ||
| + | strData15 = new String("@akairo_no_sora"); | ||
| + | |||
| + | document.write(strData15, " ,文字コード変換 ->"); | ||
| + | for(n = 1;n <= strData15.length;n++){ | ||
| + | document.write(strData15.charCodeAt(strData15,n), ", "); | ||
| + | } | ||
| + | document.write("</BR>"); | ||
| + | |||
| + | </syntaxhighlight> | ||
| + | |||
| + | |||
| + | 表示結果: | ||
| + | |||
| + | <yjavascript> | ||
| + | strData15 = new String("@akairo_no_sora"); | ||
| + | |||
| + | document.write(strData15, " ,文字コード変換 ->"); | ||
| + | for(n = 1;n <= strData15.length;n++){ | ||
| + | document.write(strData15.charCodeAt(strData15,n), ", "); | ||
| + | } | ||
| + | document.write("</BR>"); | ||
| + | </yjavascript> | ||
== '''文字コード変換(ISO Latin-1コード→文字列) fromCharCode ''' == | == '''文字コード変換(ISO Latin-1コード→文字列) fromCharCode ''' == | ||