OLD | NEW |
1 Character code constants. | 1 Character code constants. |
2 | 2 |
| 3 [![Build Status](https://travis-ci.org/dart-lang/charcode.svg?branch=master)](ht
tps://travis-ci.org/dart-lang/charcode) |
| 4 [![Pub](https://img.shields.io/pub/v/charcode.svg)](https://pub.dartlang.org/pac
kages/charcode) |
| 5 |
3 These libraries define symbolic names for some character codes. | 6 These libraries define symbolic names for some character codes. |
4 | 7 |
5 This is not an official Goggle package, and is not supported by Google. | |
6 | |
7 ## Using | 8 ## Using |
8 | 9 |
9 Import either one of the libraries: | 10 Import either one of the libraries: |
10 | 11 |
11 import "package:charcode/ascii.dart" | 12 ```dart |
12 import "package:charcode/html_entity.dart" | 13 import "package:charcode/ascii.dart"; |
| 14 import "package:charcode/html_entity.dart"; |
| 15 ``` |
13 | 16 |
14 or import both libraries using the `charcode.dart` library: | 17 or import both libraries using the `charcode.dart` library: |
15 | 18 |
16 import "package:charcode/charcode.dart" | 19 ```dart |
| 20 import "package:charcode/charcode.dart"; |
| 21 ``` |
17 | 22 |
18 # Naming | 23 # Naming |
19 | 24 |
20 The character names are preceded by a `$` to avoid conflicting with other | 25 The character names are preceded by a `$` to avoid conflicting with other |
21 variables due to the short and common names (for example "$i"). | 26 variables due to the short and common names (for example "$i"). |
22 | 27 |
23 The characters that are valid in a Dart identifier directly follow the `$`. | 28 The characters that are valid in a Dart identifier directly follow the `$`. |
24 Examples: `$_`, `$a`, `$B` and `$3`. Other characters are given symbolic names. | 29 Examples: `$_`, `$a`, `$B` and `$3`. Other characters are given symbolic names. |
25 | 30 |
26 The names of letters are lower-case for lower-case letters, and mixed- or | 31 The names of letters are lower-case for lower-case letters, and mixed- or |
27 upper-case for upper-case letters. The names of symbols are all lower-case, | 32 upper-case for upper-case letters. The names of symbols are all lower-case, |
28 and omit suffixes like "sign", "symbol" and "mark". E | 33 and omit suffixes like "sign", "symbol" and "mark". |
29 xamples: `$plus`, `$exclamation` | 34 Examples: `$plus`, `$exclamation` |
30 | 35 |
31 The `ascii.dart` library defines a symbolic name for each ASCII character. | 36 The `ascii.dart` library defines a symbolic name for each ASCII character. |
32 For some chraceters, it has more than one name. For example the common `$tab` | 37 For some characters, it has more than one name. For example the common `$tab` |
33 and the official `$ht` for the horisontal tab. | 38 and the official `$ht` for the horizontal tab. |
34 | 39 |
35 The `html_entity.dart` library defines a constant for each HTML 4.01 character | 40 The `html_entity.dart` library defines a constant for each HTML 4.01 character |
36 entity, using the standard entity abbreviation, incluing its case. | 41 entity, using the standard entity abbreviation, including its case. |
37 Examples: `$nbsp` for `&nbps;`, `$aring` for the lower-case `å` | 42 Examples: `$nbsp` for `&nbps;`, `$aring` for the lower-case `å` |
38 and `$Aring` for the upper-case `Å`. | 43 and `$Aring` for the upper-case `Å`. |
39 | 44 |
40 The HTML entities includes all characters in the Latin-1 code page, greek | 45 The HTML entities includes all characters in the Latin-1 code page, greek |
41 letters and some mathematical symbols. | 46 letters and some mathematical symbols. |
42 | 47 |
43 The `charcode.dart` library just exports both `ascii.dart` and | 48 The `charcode.dart` library just exports both `ascii.dart` and |
44 `html_entity.dart`. | 49 `html_entity.dart`. |
45 | 50 |
46 # Rationale | 51 # Rationale |
47 | 52 |
48 The Dart language doesn't have character literals. If that ever happens, this | 53 The Dart language doesn't have character literals. If that ever happens, this |
49 library will be irrelevant. Until then, this library can be used for the most | 54 library will be irrelevant. Until then, this library can be used for the most |
50 common characters. | 55 common characters. |
51 See [http://dartbug.com/4415](request for character literals). | 56 See [request for character literals](http://dartbug.com/4415). |
OLD | NEW |