checking for line ending types
checking for line ending types
- Subject: checking for line ending types
- From: email@hidden (Heinrich Giesen)
- Date: Mon, 29 Nov 2004 10:36:16 +0100
Hello,
why not use the NSString - method:
getLineStart:end:contentsEnd:forRange:
for finding line endings whatever they look like ?
description:
Returns by reference the indexes of the smallest range of lines containing aRange. Raises an <x-tad-bigger>NSRangeException</x-tad-bigger> if aRange is invalid. A line is delimited by any of these characters, the longest possible sequence being preferred to any shorter:
• <x-tad-bigger>U+000D</x-tad-bigger> (<x-tad-bigger>\r</x-tad-bigger> or CR)
• <x-tad-bigger>U+2028</x-tad-bigger> (Unicode line separator)
• <x-tad-bigger>U+000A</x-tad-bigger> (<x-tad-bigger>\n</x-tad-bigger> or LF)
• <x-tad-bigger>U+2029</x-tad-bigger> (Unicode paragraph separator)
• <x-tad-bigger>\r\n</x-tad-bigger>, in that order (also known as CRLF)
When this method returns, startIndex contains the index of the first character of the line, which is at or before the location of aRange; lineEndIndex contains the index of the first character past the line terminator; and contentsEndIndex contains the index of the first character of the line terminator itself. You may pass a <x-tad-bigger>NULL</x-tad-bigger> pointer for any of these arguments, in which case the work to compute the value isn’t performed.
You can use the results of this method to construct ranges for lines by using the start index as the range’s location and the difference between the end index and the start index as the range’s length.
--
Heinrich Giesen
email: email@hidden
_______________________________________________
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