• 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: LD <email@hidden>
  • Date: Thu, 29 Sep 2005 08:23:53 +1000

Hi there,

On 29/09/2005, at 12:42 AM, Eric Stewart wrote:

I tried the code you suggested:
value = value.replaceAll( "(\\Q\\E|\\s)+", " " ).trim();

Not what I wrote. The above is wrong.

It did not result in the expected result, here is the result.
" abc    bb " --> "a b c  b b"

You've left out the html non-breaking-space entity ("&nbsp;") between the \\Q and \\E and so it is matching every character and thus inserting a space between them all. Is your email client showing HTML? Make sure you view the Plain Text view of this email...


String value = context().request().stringFormValueForKey ( "input_field" );
value = value.replaceAll( "(\\Q&nbsp;\\E|\\s)+", " " ).trim();


e.g.,
" abc  &nbsp;  &nbsp;bb " --> "abc bb"

with regards,
--

LD


_______________________________________________ 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
References: 
 >Can't remove extraneous spacing. (From: Eric Stewart <email@hidden>)
 >Re: Can't remove extraneous spacing. (From: Art Isbell <email@hidden>)
 >Re: Can't remove extraneous spacing. (From: Eric Stewart <email@hidden>)
 >Re: Can't remove extraneous spacing. (From: LD <email@hidden>)
 >Re: Can't remove extraneous spacing. (From: Eric Stewart <email@hidden>)

  • Prev by Date: [SOLVED]Re: WOCookie value() returns quoted/parenthesized string not string
  • Next by Date: Error on Scheduled Restart
  • Previous by thread: Re: Can't remove extraneous spacing.
  • Next by thread: AW: Can't remove extraneous spacing.
  • Index(es):
    • Date
    • Thread