Re: Removing blanks spaces
- From: Roedy Green <see_website@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 28 Jun 2007 12:41:12 GMT
On Wed, 27 Jun 2007 12:46:58 -0400, "Roy Gourgi" <royng@xxxxxxxxxxxx>
wrote, quoted or indirectly quoted someone who said :
For example if I have a variable x = " 10" and I would like to remove the
4 spaces before the 10 so that the variable x = "10".
Also if I again have a variable x = "10 " and I would like to remove the
4 spaces after the 10 so that the variable x = "10".
The practical solution in to use a search/replace utility such as
Funduc SR http://mindprod.com/jgloss/searchreplace.html
You then search for a regex for multiple blanks and replace with a
single blank. However that would collapse blanks inside quotes as
well.
If you want a smart one, you need to write a finite state machine to
march through all characters in the file and decide which blanks to
keep and which to discard.
You might have a look at the source code for Compactor (which
collapses blanks and blank lines for HTML)
http://mindprod.com/products1.html#COMPACTOR
Tabin and Tabout have more complex finite state machines, but they
ware written in C. See
http://mindprod.com/products.html#TABIN
http://mindprod.com/products.html#TABOUT
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.
- References:
- Removing blanks spaces
- From: Roy Gourgi
- Removing blanks spaces
- Prev by Date: Re: double with precision
- Next by Date: Re: how does windows find java.exe?
- Previous by thread: Re: Removing blanks spaces
- Next by thread: double with precision
- Index(es):