@@ -24,8 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
2424 * // set font , text color.
2525 * make.font([UIFont boldSystemFontOfSize:14]).textColor([UIColor blackColor]);
2626
27- * // inset text
28- * make.insert(@"@迷你世界联机 :@江叔 用小淘气耍赖野人#迷你世界#", 0);
27+ * make.append(@"@迷你世界联机 :@江叔 用小淘气耍赖野人#迷你世界#");
2928
3029 * make.regexp(@"[@][^@]+\\s", ^(SJAttributesRangeOperator * _Nonnull matched) {
3130 * matched.textColor([UIColor purpleColor]);
@@ -124,7 +123,8 @@ extern NSMutableAttributedString *sj_makeAttributesString(void(^block)(SJAttribu
124123 NSRange matchedRange = [obj rangeValue];
125124
126125 make.replace(matchedRange, @"h");
127- make.insert(@"ello", matchedRange.location + matchedRange.length); // h + ello == hello
126+ NSInteger index = matchedRange.location + matchedRange.length;
127+ make.insert(@"ello", index); // h + ello == hello
128128 }];
129129 }, YES);
130130 **/
@@ -133,7 +133,7 @@ extern NSMutableAttributedString *sj_makeAttributesString(void(^block)(SJAttribu
133133
134134/* *
135135 make.regexp_replace(@"Hello", @" World!");
136- make.regexp_replace(@"Hello", [UIImage imageNamed:@"sample2"], CGPointMake(0, 0) , CGSizeZero);
136+ make.regexp_replace(@"Hello", [UIImage imageNamed:@"sample2"], CGPointZero , CGSizeZero);
137137 */
138138@property (nonatomic , copy , readonly ) void (^regexp_replace)(NSString *regexp, id replaceByStrOrAttrStrOrImg, ...);
139139
@@ -144,7 +144,7 @@ typedef NS_ENUM(NSUInteger, SJAttributeRegexpInsertPosition) {
144144};
145145/* *
146146 make.regexp_insert(@"Hello", SJAttributeRegexpInsertPositionRight, @" World!");
147- make.regexp_insert(@"Hello", SJAttributeRegexpInsertPositionRight, [UIImage imageNamed:@"sample2"], CGPointMake(0, 0) , CGSizeZero);
147+ make.regexp_insert(@"Hello", SJAttributeRegexpInsertPositionRight, [UIImage imageNamed:@"sample2"], CGPointZero , CGSizeZero);
148148 */
149149@property (nonatomic , copy , readonly ) void (^regexp_insert)(NSString *regexp, SJAttributeRegexpInsertPosition position, id insertingStrOrAttrStrOrImg, ...);
150150
@@ -167,7 +167,7 @@ typedef NS_ENUM(NSUInteger, SJAttributeRegexpInsertPosition) {
167167#pragma mark - 插入 - insert
168168@interface SJAttributeWorker (Insert)
169169
170- #pragma mark - often
170+ #pragma mark - 常用方法
171171
172172/* *
173173 append text.
@@ -177,6 +177,9 @@ typedef NS_ENUM(NSUInteger, SJAttributeRegexpInsertPosition) {
177177 */
178178@property (nonatomic , copy , readonly ) SJAttributesRangeOperator *(^append)(id strOrImg, ...);
179179
180+
181+
182+
180183#pragma mark -
181184/* !
182185 * the range of the last inserted text.
0 commit comments