• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can't remove extraneous spacing.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't remove extraneous spacing.


  • Subject: Re: Can't remove extraneous spacing.
  • From: Eric Stewart <email@hidden>
  • Date: Wed, 28 Sep 2005 00:23:52 -0400

I figured out the problem but it's turned up something I don't understand.

I'm getting the input from the request like this:

String value = context().request().stringFormValueForKey("input_field");

When someone enters enters the html entity for a non-breaking space it
is not collapsed with the replaceall() I was using, which makes since.

When I print a string containing a non-breaking space to the console
it's show the space character as /312. For example:

my[non-breaking space]input would print in the console as my\312input

What is that \312 ?

Also, how do I convert all the incoming non-breaking spaces to normal
spaces which will collapse with the replaceall() method?

Thanks a million.
Eric Stewart

On 9/28/05, Art Isbell <email@hidden> wrote:
> On Sep 27, 2005, at 3:43 PM, Eric Stewart wrote:
>
> > The problem I'm having is that somehow extra spaces between words are
> > making it into the database.
> >
> > I'm using the following code to remove all extra spaces:
> >
> > value = value.replaceAll("\\s+", " ");
> >
> > But some how input is still making it into the database that is more
> > than 1 space between words.
>
>      Your Java should work although
>
> value = value.replaceAll("\\s{2,}", " ");
>
> would ignore single spaces unlike your code.
>
>      Where are you using the above statement?  Are you certain that
> it is being executed for every string being saved to the DB?
>
> Aloha,
> Art
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Can't remove extraneous spacing.
      • From: LD <email@hidden>
References: 
 >Can't remove extraneous spacing. (From: Eric Stewart <email@hidden>)
 >Re: Can't remove extraneous spacing. (From: Art Isbell <email@hidden>)

  • Prev by Date: Re: Can't remove extraneous spacing.
  • Next by Date: AW: Can't remove extraneous spacing.
  • Previous by thread: Re: Can't remove extraneous spacing.
  • Next by thread: Re: Can't remove extraneous spacing.
  • Index(es):
    • Date
    • Thread