Solved

Strip one or many  white space

Posted on 2002-04-26
3
218 Views
Last Modified: 2010-03-05
Hi,

I need to strip of additional white space in between my strings. eg.

$String = 'Alexandra Bill  Horn'
code to strip the extra white space..
$String = 'Alexandra Bill Horn'

This additional white space might occur in between words.

Thanks,
Nick

0
Comment
Question by:n_chai
  • 2
3 Comments
 
LVL 6

Expert Comment

by:andreif
ID: 6970659
Hi,

$String =~ s/[ ]+/ /g;

if you need to strit tabulations also, use this

$String =~ s/\s+/ /g;

Good luck!
0
 
LVL 6

Accepted Solution

by:
andreif earned 50 total points
ID: 6988074
Hi,

$String =~ s/[ ]+/ /g;

if you need to strip tabulations also, use this

$String =~ s/\s+/ /g;

Good luck!
0
 

Author Comment

by:n_chai
ID: 7055185
Thanks, I think I asked the same question again.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question