• 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: subStrings separated by...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: subStrings separated by...


  • Subject: Re: subStrings separated by...
  • From: arturo <email@hidden>
  • Date: Wed, 17 Dec 2003 18:18:18 -0500

As an aside,

Regexes are great.  I've used them a ton.  But once they get past a certain
size they become near unintelligible.
So, as with all sharp instruments, don't just start hacking away with it.
You might hurt someone :-)

----- Original Message -----
From: "Sam Barnum" <email@hidden>
To: "WOdev List List" <email@hidden>
Sent: Wednesday, December 17, 2003 5:56 PM
Subject: Re: subStrings separated by...


> agree that regex is your best bet, works with very little code.  It
> will be nice when we don't have to worry so much about someone running
> it on java < 1.4, since regexp is wonderfully suited for this kind of
> thing.
>
> public void validateFoo(String code) {
>      String pattern = "^[A-Z]{3}-[0-9]{6}-[A-Z0-9]{3}$";
>      if (code==null || !code.matches(pattern)) {
>          throw new ValidationException("Invalid code entered");
>      }
> }
> On Wednesday, December 17, 2003, at 01:34 PM, Ricardo Strausz wrote:
>
> > Hola!
> >
> > This most be an easy one (for someone who knows Java);
> > in a validateAtribute(String value) method of an EOGenericRecord's
> > child, I want to check if the value have the form ABC-123456-XYZ (3
> > letters, dash, 6 numbers, dash, 3 alphanumeric characters). In Obj-C,
> > while using NSString, you simply use
> >
> > NSArray anArrayOfStrings = [value componentsSeparatedByString:@"-"];
> >
> > and then parse each of the 3 elements in the array.
> >
> > java.lang.String does not seem to have such a method (nor any that
> > returns an array or vector).
> >
> > Any idea on how to acomplish this.
> >
> > Gracias,
> > Dino
> > _______________________________________________
> > webobjects-dev mailing list | email@hidden
> > Help/Unsubscribe/Archives:
> > http://www.lists.apple.com/mailman/listinfo/webobjects-dev
> > Do not post admin requests to the list. They will be ignored.
> _______________________________________________
> webobjects-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: subStrings separated by... (From: Sam Barnum <email@hidden>)

  • Prev by Date: Re: sending a url with international characters
  • Next by Date: Re: subStrings separated by...
  • Previous by thread: Re: subStrings separated by...
  • Next by thread: Can't load application class.
  • Index(es):
    • Date
    • Thread