• 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: searching a Unicode string in a text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: searching a Unicode string in a text


  • Subject: Re: searching a Unicode string in a text
  • From: Ondra Cada <email@hidden>
  • Date: Fri, 20 Sep 2002 14:29:28 +0200

On Friday, September 20, 2002, at 12:52 , Ondra Cada wrote:

if( range.location == 0 && range.length == [string length] ) return
[[[NSString alloc] initWithString:@"1"] autorelease];

I don't quite follow this part.

- if you just wanted to know whether the string is at the beginning ("range.location==0"), you can use hasPrefix: instead of rangeOfString:;

- and (sorry, just now I've noticed I forgot to add), if you just wanted to know whether those strings are equal, there's isEqualToString:.

Also, I am not sure in which extent this is actually implemented in the current Foundation Kit, but at least in principle with Unicode it is possible that [s1 isEqualToString:s2], but [s1 length]!=[s2 length] (due to composite characters).
---
Ondra Hada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: searching a Unicode string in a text
      • From: Andreas Mayer <email@hidden>
References: 
 >Re: searching a Unicode string in a text (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: NSView coordinate System
  • Next by Date: mini - miniWindowImage
  • Previous by thread: Re: searching a Unicode string in a text
  • Next by thread: Re: searching a Unicode string in a text
  • Index(es):
    • Date
    • Thread