Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How does -getLineStart:end:contentsEnd:forRange work ?



>Use NSString methods such as lineRangeForRange:, paragraphRangeForRange:,
>getLineStart:end:contentsEnd:forRange:, or
getParagraphStart:end:contentsEnd:forRange:.

  Thanks for your advice Douglas. Unfortunately, as it's my first encounter
with those functions I got everything wrong again. Just to gain familiarity
with the     -getLineStart:end:contentsEnd:forRange, I tried the following
fantasy
code :

        unsigned* startIndex=47;
	unsigned* lineEndIndex=48;
	unsigned* contentsEndIndex=49;
	unsigned i;
    for (i=0;i<l1;i++) {
	      [z1 getLineStart:startIndex
	          end:lineEndIndex
		      contentsEnd:contentsEndIndex
		      forRange: NSMakeRange(i,1)];
	}
(z1 is an NSString whose length is large,>50).

 The loop crashes immediately (when i=0). What is wrong with
this code ?  (in my mind it was supposed to compute for each i
the index of the line containing the ith character).

                                        Ewan




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.