• 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: NSString comparisons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString comparisons


  • Subject: Re: NSString comparisons
  • From: Michael Engelhart <email@hidden>
  • Date: Wed, 14 Apr 2004 10:01:57 -0500

Generally for simple matches like this I just use the built in java.lang.String matches() method like:

String s = "aaaaab";
boolean b = s.matches("a*b");
System.out.println(b);

prints "true" on my 1.4.2_03 JDK.

BTW, this also works fine on my machine:
import java.util.regex.Pattern;

public class Test {
	public static void main(String[] args) {
		boolean b = Pattern.matches("a*b", "aaaaab");
		System.out.println(b);
	}
}

Did you import java.util.regex.Pattern in your test case?

Mike
On Apr 14, 2004, at 9:34 AM, Randall Perry wrote:

Hmmm...speaking of regex...

Tried using this example in the Sun 1.4.2 docs in my code:
    boolean b = Pattern.matches("a*b", "aaaaab");

And got the compile error "cannot resolve symbol : variable Pattern"

Just double-checked my java version in terminal; it's 1.4.2_03.



Ahhh, then you should check out Sun's Java site. The javadocs there are
very good. If you're using 1.4.2, the new build in regex functionality
might be of use too.


On 14/04/2004, at 11:42, Randall Perry wrote:

Oops...sorry, it's been a long day. Too much WO studying :-E

Right, I'm using String not NSString.

-- Randall Perry sysTame

Xserve Web Hosting/Co-location
Website Development/Promotion
Mac Consulting/Sales

http://www.systame.com/
_______________________________________________
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: NSString comparisons (From: Randall Perry <email@hidden>)

  • Prev by Date: Re: NSString comparisons
  • Next by Date: Re: How can I stream blobs to/from entities?
  • Previous by thread: Re: NSString comparisons
  • Next by thread: Re: NSString comparisons
  • Index(es):
    • Date
    • Thread