as if sorting :Ĭonsole.log(names.sort(pare).join(", ")) Var germanPhonebook = new Intl.Collator("de-DE-u-co-phonebk") Phonebook sort emphasizes sound, and it’s as if “ä”, “ö”, and so on were expanded to “ae”, “oe”, and so on prior to sorting. The Collator object is useful for comparing and sorting strings.įor example, there are actually two different sort orders in German, phonebook and dictionary. Var hanDecimalRMBInChina = new Intl.NumberFormat("zh-CN-u-nu-hanidec",Ĭonsole.log(hanDecimalRMBInChina.format(1314.25)) // ¥ 一,三一四.二五 var gasPrice = new Intl.NumberFormat("en-US",Ĭonsole.log(gasPrice.format(5.259)) // $5.259 The NumberFormat object is useful for formatting numbers, for example currencies. Var americanDateTime = new Intl.DateTimeFormat("en-US", options).format Ĭonsole.log(americanDateTime(july172014)) // 07/16/14, 5:00 PM PDT With simple Unicode escapes it is often necessary to write the surrogate halves separately to achieve the same. With Unicode code point escapes, any character can be escaped using hexadecimal numbers so that it is possible to use Unicode code points up to 0x10FFFF. '\u00A9' // "©" Unicode code point escapes The Unicode escape sequences require at least four characters following \u. The number after \x is interpreted as a hexadecimal number. More advanced strings can be created using escape sequences: Hexadecimal escape sequences You can create simple strings using either single or double quotes: 'foo' You can create strings using string literals or string objects. The length of a String is the number of elements in it. The first element is at index 0, the next at index 1, and so on. Each element in the String occupies a position in the String. It is a set of "elements" of 16-bit unsigned integer values. JavaScript's String type is used to represent textual data. #USING CODEPOINTS JAVASCRIPT HOW TO#This chapter introduces how to work with strings and text in JavaScript.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |