Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Say String

by Odud (Pilgrim)
on Apr 09, 2008 at 15:17 UTC ( #679271=perlquestion: print w/replies, xml ) Need Help??

Odud has asked for the wisdom of the Perl Monks concerning the following question:

I'm looking for a module that given a string such as "Lo1" will produce "Upper case letter L, Lower case letter o, figure 1" say. I'm pretty sure that I saw such a thing many years ago but searching CPAN I can't find it. I guess I could extend Lingua::Alphabet::Phonetic but I don't want to reinvent a wheel if there is one already. Apologies if my search of CPAN was insufficient. For the curious I'm trying to come up with a way of communicating machine generated passwords to users - the passwords contain lots of confusable characters e.g. 1lLoO0 etc, but I can't fix that!

Replies are listed 'Best First'.
Re: Say String
by deibyz (Hermit) on Apr 09, 2008 at 15:45 UTC
      Thanks, that looks familiar - can't think why my searching didn't find it.
Re: Say String
by thundergnat (Deacon) on Apr 09, 2008 at 16:54 UTC

    Maybe you are thinking of the charnames pragma?

    #!/usr/bin/perl use warnings; use strict; use charnames(); my $string = 'Lo1'; print string_to_text($string); sub string_to_text{ my @chars; push @chars, charnames::viacode(ord($_)) for split //, $_[0]; return join ', ', @chars; }

    Yields...

    LATIN CAPITAL LETTER L, LATIN SMALL LETTER O, DIGIT ONE
    
      Also looks good - I'll try both and see which will be easier for a non-specialist user to understand.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://679271]
Approved by Joost
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2023-01-27 14:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?