Solved

Strip one or many  white space

Posted on 2002-04-26
3
216 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks, I think I asked the same question again.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now