Re: Removing blanks spaces



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
.