Typescript-string-length

提供:Dev Guides
2020年6月22日 (月) 23:32時点におけるMaintenance script (トーク | 投稿記録)による版 (Imported from text file)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先:案内検索

TypeScript-文字列の長さプロパティ

文字列の長さを返します。

var uname = new String("Hello World")
console.log(uname)
console.log("Length "+uname.length) //returns the total number of characters
                                    //including whitespace

コンパイル時に、JavaScriptで同じコードが生成されます。

その出力は次のとおりです-

Hello World
Length 11