1String::ToIdentifier::EUNs(e3r)Contributed Perl DocumentSattriionng::ToIdentifier::EN(3)
2
3
4

NAME

6       String::ToIdentifier::EN - Convert Strings to English Program
7       Identifiers
8

SYNOPSIS

10           use utf8;
11           use String::ToIdentifier::EN 'to_identifier';
12
13           to_identifier 'foo-bar';             # fooDashBar
14           to_identifier 'foo-bar', '_';        # foo_dash_bar
15           to_identifier 'foo.bar', '_';        # foo_dot_bar
16           to_identifier "foo\x{4EB0}bar";      # fooJingBar
17           to_identifier "foo\x00bar";          # fooNullCharBar
18           to_identifier "foo\x00\x00bar";      # foo2NullCharsBar
19           to_identifier "foo\x00\x00bar", '_'; # foo_2_null_chars_bar
20
21           {
22               no utf8;
23               to_identifier "foo\xFF\xFFbar.baz";      # foo_2_0xFF_BarDotBaz
24               to_identifier "foo\xFF\xFFbar.baz", '_'; # foo_2_0xFF_bar_dot_baz
25           }
26

DESCRIPTION

28       This module provides a utility method, "to_identifier" for converting
29       an arbitrary string into a readable representation using the ASCII
30       subset of "\w" for use as an identifier in a computer program. The
31       intent is to make unique identifier names from which the content of the
32       original string can be easily inferred by a human just by reading the
33       identifier.
34
35       If you need the full set of "\w" including Unicode, see the subclass
36       String::ToIdentifier::EN::Unicode.
37
38       Currently, this process is one way only, and will likely remain this
39       way.
40
41       The default is to create camelCase identifiers, or you may pass in a
42       separator char of your choice such as "_".
43
44       Binary char groups will be separated by "_" even in camelCase
45       identifiers to make them easier to read, e.g.: "foo_2_0xFF_Bar".
46

EXPORT

48       Optionally exports the "to_identifier" function.
49

SUBROUTINES

51   to_identifier
52       Takes the string to be converted to an identifier, and optionally a
53       separator char such as "_". If a separator char is not provided, a
54       camelCase identifier will be returned.
55

METHODS

57   string_to_identifier
58       The class method version of "to_identifier", if you want to use the
59       object oriented interface.
60

SEE ALSO

62       String::ToIdentifier::EN::Unicode, Text::Unidecode,
63       Lingua::EN::Inflect::Phrase
64

AUTHOR

66       Rafael Kitover, "<rkitover@gmail.com>"
67

REPOSITORY

69       <http://github.com/rkitover/string-toidentifier-en>
70
72       Copyright (c) 2018 Rafael Kitover <rkitover@gmail.com>.
73
74       This program is free software; you can redistribute it and/or modify it
75       under the terms of either: the GNU General Public License as published
76       by the Free Software Foundation; or the Artistic License.
77
78       See http://dev.perl.org/licenses/ for more information.
79
80
81
82perl v5.36.0                      2023-01-20       String::ToIdentifier::EN(3)
Impressum