freelanceprogrammers.org Forum Index » Perl

Re: Digest Number 278


View user's profile Post To page top
maneesh1978 Posted: Wed Jun 02, 2004 2:11 pm


Joined: 02 Jun 2004

Posts: 2
Re: Digest Number 278
I have 2 ways to do it.

1st is

$string = "JAPH";
@ascii = unpack("C*", $string);
print join(", ", @ascii);

2nd :

chr(ord($string));


perl_official@yahoogroups.com wrote:

There are 2 messages in this issue.

Topics in this digest:

1. How to cenvert to ascii
From: Gilles Beauregard
2. RE: How to cenvert to ascii
From:


________________________________________________________________________
________________________________________________________________________

Message: 1
Date: Mon, 31 May 2004 08:18:04 -0400
From: Gilles Beauregard
Subject: How to cenvert to ascii

Allo!

How to convert the following string to regular ascii:

mailto:we

Have a nice and spam free day.

Gilles B.

--
Encore plus de trucs et d`astuces pour Webmasters
http://www.biwi.qc.ca/favori/
More Webmastering trics:
http://www.biwi.qc.ca/favorite/
--



________________________________________________________________________
________________________________________________________________________

Message: 2
Date: Tue, 1 Jun 2004 07:59:28 +0200
From:
Subject: RE: How to cenvert to ascii

> How to convert the following string to regular ascii:
>
> mailto:we

I guess you mean: How do you get the character equivalent to ASCII code
109 etc.

(1) (split /;/) turns your string into a list of items.
(2) Of each item, drop the first two characters (&#) and any leading
zero
(to avoid being it interpreted as octal in step 3)
(3) You end up with a list of numbers 109 97 105 etc. Use the chr
function
to turn it into a character.

Ronald


________________________________________________________________________
________________________________________________________________________



------------------------------------------------------------------------
Yahoo! Groups Links




------------------------------------------------------------------------



---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger

[Non-text portions of this message have been removed]
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help