5#include "flutter/fml/platform/darwin/string_range_sanitization.h"
10 if (
text == nil || index >
text.length) {
11 return NSMakeRange(NSNotFound, 0);
13 if (index <
text.length) {
14 return [
text rangeOfComposedCharacterSequenceAtIndex:index];
16 return NSMakeRange(index, 0);
20 if (
text == nil || range.location + range.length >
text.length) {
21 return NSMakeRange(NSNotFound, 0);
23 NSRange sanitizedRange = [
text rangeOfComposedCharacterSequencesForRange:range];
27 return NSMakeRange(sanitizedRange.location, range.length);
NSRange RangeForCharacterAtIndex(NSString *text, NSUInteger index)
NSRange RangeForCharactersInRange(NSString *text, NSRange range)