pub repository
mirror.p-hatan.comcharcode
1.2.0-nullsafety.2Constants for ASCII and common non-ASCII character codes.
Readme
-Build Status -Pub -
Character code constants
This package defines symbolic names for some character codes (aka. code points).
They can used when working directly with characters as integers,
to make the code more readable: if (firstChar == $A) ....
This is not an official Google package, and is not supported by Google.
Usage
Import either one of the libraries:
import "package:charcode/ascii.dart";
import "package:charcode/html_entity.dart";
or import both libraries using the charcode.dart library:
import "package:charcode/charcode.dart";
Naming
The character names are preceded by a $ to avoid conflicting with other
variables, due to their short and common names (for example "$i").
Characters that are valid in a Dart identifier directly follow the $.
Examples: $_, $a, $B and $3. Other characters are given symbolic names.
The names of letters are lower-case for lower-case letters ($sigma for σ),
and mixed- or upper-case for upper-case letters ($Sigma for Σ).
The names of symbols and punctuation are all lower-case,
and omit suffixes like "sign", "symbol" and "mark".
Examples: $plus, $exclamation, $tilde.
The ascii.dart library defines a symbolic name for each ASCII character.
Some characters have more than one name. For example the common name $tab
and the official abbreviation $ht for the horisontal tab.
The html_entity.dart library defines a constant for each HTML 4.01 character
entity using their standard entity abbreviation, including case.
Examples: $nbsp for &nbps;, $aring for the lower-case å
and $Aring for the upper-case Å.
The HTML entities include all characters in the Latin-1 code page, greek letters and some mathematical symbols.
The charcode.dart library exports both ascii.dart and
html_entity.dart. Where both libraries define the same name,
the HTML entity name is preferred.
Rationale
The Dart language doesn't have character literals. If that ever changes, this package will become irrelevant. Until then, this package can be used for the most common characters. See [http://dartbug.com/4415](request for character literals).
Changelog
1.2.0-nullsafety.2
- Allow prerelease versions of the 2.12 sdk.
- Add command line functionality to generate constants.
Allows clients to generate their own constants instead of
depending on the package at run-time.
Example: To generate the characters needed
for a hexadecimal numeral, run
pub run charcode a-fA-F\d+-.
1.2.0-nullsafety.1
- Allow 2.10 stable and 2.11.0 dev SDK versions.
1.2.0-nullsafety
- Opt in to null safety.
1.1.3
- Added example, changed lints.
1.1.2
- Updated the SDK constraint.
1.1.1
- Spelling and linting fixes.
1.1.0
- Initial version
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add charcodepubspec.yaml
name: charcode
version: 1.2.0-nullsafety.2
description: >
Constants for ASCII and common non-ASCII character codes.
environment:
# This must remain a tight constraint until nnbd is stable
sdk: '>=2.10.0-0 <2.12.0'
dev_dependencies:
test: ^1.16.0-nullsafety
pedantic: ^1.10.0-nullsafety
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 1.0.0 | 2014-06-26T09:28:21.694420Z | Download | 512b3f1f0a693a346c37bb616281ffd4ffe886b6de11fa62f06e2f4294b30efc |
| 1.0.0+1 | 2014-09-05T09:47:41.933800Z | Download | 0f9c762b81ee6b0963eac97c1f894aabcb6fc0ba2c3b15a96acf9859e4e8838f |
| 1.1.0 | 2014-09-10T09:54:12.532630Z | Download | c510584ba541a09cc6b97272138d47af095efc2c69e10629ebb0fdd0ae59db6f |
| 1.1.1 | 2016-11-19T17:35:15.793Z | Download | c3a733a042234bbe813741c41a298232ce162feb6ffd2b368b54aa1d995256e0 |
| 1.1.2 | 2018-07-11T17:46:00.382487Z | Download | 3b2184de710a811255c3243d36dd0da64d86ae7b53ab026973ccd573a1a4b987 |
| 1.1.3 | 2020-02-11T15:37:32.663984Z | Download | abac3bd18780f688ff2b93914f7ed2d4e9405835cbed1f09298ef65e278f23a2 |
| 1.2.0-nullsafety | 2020-07-29T16:13:16.511645Z | Download | 4bc611337e54c8f7a2d0c05394c56372116ba430defb4f4a94c5b97b17e74d39 |
| 1.2.0-nullsafety.1 | 2020-09-22T15:49:23.459366Z | Download | be9446ac9253d431979b8bf1b08588234e7ae0d1442ff5bab286c6c64bb03622 |
| 1.2.0-nullsafety.2 | 2020-10-26T10:44:46.720944Z | Download | 395cc0e31d6a7b9288955779d5fedc13ef8c9aae93551fd4d5e7d45f46e91dd5 |
| 1.2.0-nullsafety.3 | 2020-11-04T10:56:47.500858Z | Download | 438cd4d6e819eae86b02fbf1257ce68ea55c117c3e24f0c01b3ba9af5faff403 |
| 1.2.0 | 2021-02-02T17:11:52.888788Z | Download | 8e36feea6de5ea69f2199f29cf42a450a855738c498b57c0b980e2d3cca9c362 |
| 1.3.0 | 2021-06-09T13:15:32.450552Z | Download | ad3e299d61ecac58b5ca8995b7b0650d3463a4cdb74dc4c7ccc5c5f775931105 |
| 1.3.1 | 2021-06-09T14:13:16.454868Z | Download | fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 |
| 1.4.0 | 2024-11-18T13:03:59.677834Z | Download | fb0f1107cac15a5ea6ef0a6ef71a807b9e4267c713bb93e00e92d737cc8dbd8a |
Dependencies
No direct dependencies declared.