The String object has one static method, String.fromCharCode()
, which is used to create a string representation from a sequence of Unicode characters. Here we build a simple string using the ASCII codes
String对象具有一个静态方法String.fromCharCode()
,该方法用于根据Unicode字符序列创建字符串表示形式。 在这里,我们使用ASCII码构建一个简单的字符串
String.fromCodePoint(70, 108, 97, 118, 105, 111) //'Flavio'
You can also use octal or hexadecimal numbers:
您还可以使用八进制或十六进制数字:
String.fromCodePoint(0x46, 0154, parseInt(141, 8), 118, 105, 111) //'Flavio'
All the other methods described here are instance methods: methods that are run on a string type.
此处描述的所有其他方法都是实例方法 :在字符串类型上运行的方法。
实例方法 (Instance methods)
A string offers a few unique methods you can use:
字符串提供了一些可以使用的独特方法: