String:...ier::EN(3)
π NAME π
okay so bestie, this page is String::ToIdentifier::EN(3) from the User Contributed Perl Documentation crew, and the name of the game is String::ToIdentifier::EN - Convert Strings to English Program Identifiers. literally the whole point. π
πΈ SYNOPSIS πΈ
hereβs the group-chat screenshot of how you use it, bestie:
use utf8;
use String::ToIdentifier::EN 'to_identifier';
to_identifier 'foo-bar'; # fooDashBar
to_identifier 'foo-bar', '_'; # foo_dash_bar
to_identifier 'foo.bar', '_'; # foo_dot_bar
to_identifier "foo\x{4EB0}bar"; # fooJingBar
to_identifier "foo\x00bar"; # fooNullCharBar
to_identifier "foo\x00\x00bar"; # foo2NullCharsBar
to_identifier "foo\x00\x00bar", '_'; # foo_2_null_chars_bar
{
no utf8;
to_identifier "foo\xFF\xFFbar.baz"; # foo_2_0xFF_BarDotBaz
to_identifier "foo\xFF\xFFbar.baz", '_'; # foo_2_0xFF_bar_dot_baz
}
β¨ DESCRIPTION β¨
okay so this module gives you a utility method, to_identifier, that converts an arbitrary string into a readable representation using the ASCII subset of \w so it can be used as an identifier in a computer program. the intent? to make unique identifier names where a human can easily infer the content of the original string just by reading the identifier. iykyk. π«Ά
if you need the full set of \w including Unicode, go see the subclass String::ToIdentifier::EN::Unicode. π
heads up bestie: currently, this process is one way only, and it will likely remain this way β no reverse magic promised. π
the default is to create camelCase identifiers, or you may pass in a separator char of your choice such as _. π
Binary char groups will be separated by _ even in camelCase identifiers to make them easier to read, e.g.: "foo_2_0xFF_Bar". no cap. π
π EXPORT π
optionally exports the to_identifier function. cute. β¨
π§ SUBROUTINES π§
π« to_identifier π«
takes the string to be converted to an identifier, and optionally a separator char such as _. if a separator char is not provided, a camelCase identifier will be returned. slay. π
π¦ METHODS π¦
π string_to_identifier π
the class method version of to_identifier, if you want to use the object oriented interface. periodt. π
π SEE ALSO π
String::ToIdentifier::EN::UnicodeText::UnidecodeLingua::EN::Inflect::Phrase
π AUTHOR π
Rafael Kitover, "<rkitover@gmail.com>" π
π REPOSITORY π
<http://github.com/rkitover/string-toidentifier-en> π
π LICENSE AND COPYRIGHT π
Copyright (c) 2018 Rafael Kitover <rkitover@gmail.com>.
this program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
see http://dev.perl.org/licenses/ for more information.
okay bestie, thatβs the whole page π
β this one is from perl v5.42.0, dated 2018-02-27, with footer tag String:...ier::EN(3). bye slay, go convert some strings πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-String-ToIdentifier-EN 0.12-bp160.1.11 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms