Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Delete nonprinting chars

Reply
Thread Tools

Delete nonprinting chars

 
 
fishfry
Guest
Posts: n/a
 
      09-06-2004
I know this is in the book but I can't find it at the moment ...

what's the clever way to remove all nonprinting characters from a string?
 
Reply With Quote
 
 
 
 
Ben Morrow
Guest
Posts: n/a
 
      09-06-2004

Quoth fishfry <(E-Mail Removed)>:
> I know this is in the book but I can't find it at the moment ...
>
> what's the clever way to remove all nonprinting characters from a string?


perldoc perlre
perldoc perlop

$string =~ s/[^[rint:]]//g;

Ben

--
It will be seen that the Erwhonians are a meek and long-suffering people,
easily led by the nose, and quick to offer up common sense at the shrine of
logic, when a philosopher convinces them that their institutions are not based
on the strictest morality. [Samuel Butler, paraphrased] http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      09-06-2004
fishfry wrote:
> I know this is in the book but I can't find it at the moment ...
>
> what's the clever way to remove all nonprinting characters from a
> string?


From "perldoc perlre":

The POSIX character class syntax

[:class:]

is also available. The available classes and their backslash equivalents
(if available) are as follows:
[...]
print
[...]

jue


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to truncate char string fromt beginning and replace chars instring by other chars in C or C++? Hongyu C++ 9 08-08-2008 12:18 PM
Delete chars in a file stream Bernie C++ 1 06-13-2008 12:05 PM
delete chars until end of line RicK C++ 2 07-20-2007 10:07 AM
Floats to chars and chars to floats Kosio C Programming 44 09-23-2005 09:49 AM
receiving ??? chars instead of "special" chars M.Posseth ASP .Net Web Services 3 11-16-2004 07:00 PM



Advertisments