Title: Question about split
Javier,
 
Simply change the regular expression argument to split from / */ to //.

Dirk Bremer - Systems Programmer II - ESS/AMS  - NISC St. Peters
636-922-9158 ext. 8652 fax 636-447-4471
 
----- Original Message -----
Sent: Wednesday, November 27, 2002 13:08
Subject: Question about split

Hi all,

I have a question. I found on the perl documentation (perlfunc) the usage of split and found the following example:

print join(':', split(/ */, 'hi there'));
produces the output 'h:i:t:h:e:r:e'.

but what I want to do is to also include spaces, so that the output is:

'h:i: :t:h:e:r:e'

How can I do this? The problem is that I want to parse a string and remove commas off it. What I did was split the string and create an array for it. Then I just splice'd when I found commas, but the resulting string has no spaces. If there is a better way to do this, let me know. If not, I would appreciate how to do the above, which would solve my immediate issue.

Regards,

Javier Moreno
==============
Softtek/GXS
EFS NearShore

...when you have eliminated the impossible, whatever remains, however improbable, must be the truth.
- Sherlock Holmes

Reply via email to