Typescript-string-length

提供:Dev Guides
移動先:案内検索

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