How does -getLineStart:end:contentsEnd:forRange work ?
How does -getLineStart:end:contentsEnd:forRange work ?
- Subject: How does -getLineStart:end:contentsEnd:forRange work ?
- From: email@hidden
- Date: Thu, 29 Jun 2006 16:14:08 +0200 (CEST)
- Importance: Normal
>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:
This email sent to email@hidden