Ask a Question related to PERL Miscellaneous, Design and Development.
-
john #1
uping and downing letters
Howdy,
looking for a way to change letter
# example
# a would become b, A would become B, b=c, c=d etc for upping or
# b would become a, B would become A, etc.
Ive tried a couple different things and just cant come up with a
way to do it. Would converting it to hex then changing help. and if so
how would i increment it. Or does there happento be a module with this
already done. I can do it the long way with lots of ifs but was hoping
there would be a less code intensive, simpler way to do it.
I have to be able to use a-z,A-Z,0-9, - and _ and after upping and
downing I have to be able to get the original letter back.
code, links, manpages would be appreciated
thanks john
john Guest
-
Letters printing on top of each other.
I have a problem can't find support on. The pdf file has letters appearing on top of each other. It only happens 1 time every 3 pages or so. The word... -
Shapely Letters?
What's the best way for me to place text into and a shape and actually take form of that shape (Ex. the word "heart" would actually be the shape of a... -
Capital Letters
I have a form which people use to register in a database. The form passes the input data to an asp page that then updates the database. The thing... -
how to emboss letters
Hi, how do you make writing look like it's been stamped into leather? or stainless steel - I know it's got something to do with the punch tool, but... -
outline of letters
i am trying to outline some letters, i have 2 gold script letters that i did, but now i want to outline then with a line black outline, thx in advance -
Jay Tilton #2
Re: uping and downing letters
john <wenjoh26@emNOSPAMail.pct.edu> wrote:
: looking for a way to change letter
:
: # example
: # a would become b, A would become B, b=c, c=d etc for upping or
: # b would become a, B would become A, etc.
:
: Ive tried a couple different things and just cant come up with a
: way to do it.
What techniques have you tried? How were those techniques
unacceptable?
: I have to be able to use a-z,A-Z,0-9, - and _ and after upping and
: downing I have to be able to get the original letter back.
The spec needs a little more fleshing out.
How should the edge cases be handled? For example, should an
incremented 'z' become whatever is next in the ASCII character set,
should it wrap back to 'a', turn into 'A', or something else? What
should an incremented or decremented '-' or '_' become?
Do you wish to change all the characters in a string, or only one
character?
The chr() and ord() functions may be what you want.
Or the tr/// operator may be more useful.
It depends.
Jay Tilton Guest
-
Greg Bacon #3
Re: uping and downing letters
In article <Xns93EDEFDD2B9BFwenjoh26emNOSPAMailp@216.65.98.9> ,
john <wenjoh26@emNOSPAMail.pct.edu> wrote:
: Howdy,
:
: looking for a way to change letter
:
: # example
: # a would become b, A would become B, b=c, c=d etc for upping or
: # b would become a, B would become A, etc.
This should get you started:
% cat try
#! /usr/local/bin/perl -l
$_ = "a -> b, b -> c, c -> a";
print;
tr[abc]
[bca];
print;
% ./try
a -> b, b -> c, c -> a
b -> c, c -> a, a -> b
: [...]
See the documentation on Perl's tr/// operator in the perlop manpage.
Hope this helps,
Greg
--
There are more instances of the abridgement of the freedom of the people
by the gradual and silent encroachment of those in power, than by violent
and sudden usurpation.
-- James Madison
Greg Bacon Guest
-
John W. Krahn #4
Re: uping and downing letters
john wrote:
To go "up":>
> Thanks for the help as for -,_,z,Z etc. I am just looking to push to the
> next character in askii. And I am recieving the letters in a string but
> have written the code to parse the string into an array of chars
$string =~ tr/\x0-\xFF/\x1-\xFF\x0/;
To go back "down" again:
$string =~ tr/\x1-\xFF\x0/\x0-\xFF/;
John
--
use Perl;
program
fulfillment
John W. Krahn Guest
-
Purl Gurl #5
Re: uping and downing letters
john wrote:
(snipped)
Add one to the ord() value of your character.> # a would become b, A would become B, b=c, c=d etc for upping or
Subtract one from the ord() value of your character.> # b would become a, B would become A, etc.
Print using chr($new_ord_value).
Don't be surprised if you exceed or fall below printable
values for characters. Testing will disclose what happens.
My new Purl Gurl Net is slowly propagating. Please be patient.
For some, your DNS records may not update for a week or more.
[url]http://www.purlgurl.net[/url]
Complete Perl Documentation.
Complete Apache Documentation.
Learn to speak Choctaw and lots of fun stuff!
Purl Gurl
--
#!perl
@Array = qw (O t q k 32 F t q k 32 Q n b j r);
for (@Array)
{
if ($_ == 32)
{ print chr ($_); }
else
{
$ord = (ord ($_)) + 1;
print chr ($ord);
}
}
PRINTED RESULTS:
________________
Purl Gurl Rocks
Purl Gurl Guest
-
Abigail #6
Re: uping and downing letters
John W. Krahn (krahnj@acm.org) wrote on MMMDCLVIII September MCMXCIII in
<URL:news:3F59684D.A654B57F@acm.org>:
,, john wrote:
,, >
,, > Thanks for the help as for -,_,z,Z etc. I am just looking to push to the
,, > next character in askii. And I am recieving the letters in a string but
,, > have written the code to parse the string into an array of chars
,,
,, To go "up":
,,
,, $string =~ tr/\x0-\xFF/\x1-\xFF\x0/;
Since he said ASCII, he wants:
$string =~ tr/\x0-\x7F/\x1-\x7F\x0/;
,, To go back "down" again:
,,
,, $string =~ tr/\x1-\xFF\x0/\x0-\xFF/;
And that would be:
$string =~ tr/\x1-\x7F\x0/\x0-\x7F/;
Abigail
--
#!/opt/perl/bin/perl -- # Remove trailing newline!
BEGIN{$SIG{__WARN__}=sub{$_=pop;y-_- -;print/".*(.)"/;
truncate$0,-1+-s$0;exec$0;}}//rekcaH_lreP_rehtona_tsuJ
Abigail Guest



Reply With Quote

