Skip to content

Latest commit

 

History

History
59 lines (41 loc) · 1.96 KB

File metadata and controls

59 lines (41 loc) · 1.96 KB

Charset

  • Charset(string $charset)
  • Charset(string $charset, string ...$charsets)

Validates if a string is in a specific charset.

v::charset('ASCII')->assert('sugar');
// Validation passes successfully

v::charset('ASCII')->assert('açúcar');
// → "açúcar" must consist only of characters from the "ASCII" character-set

v::charset('ISO-8859-1', 'EUC-JP')->assert('日本国');
// Validation passes successfully

The array format is a logic OR, not AND.

Templates

Charset::TEMPLATE_STANDARD

Mode Template
default {{subject}} must consist only of characters from the {{charset|list:or}} character-set
inverted {{subject}} must not consist only of characters from the {{charset|list:or}} character-set

Template placeholders

Placeholder Description
charset
subject The validated input or the custom validator name (if specified).

Categorization

  • Strings

Changelog

Version Description
3.0.0 Templates changed
2.0.0 Charset supports multiple charsets on its constructor
0.5.0 Created

See Also