ios - NSRegularExpression change following text's color after a character -


i trying change character's color , text comes , using nsregularexpression character , have no idea how can change following characters example here text :

● title...... description xxxxxx x x x x x   

so in case need change character's color , following strings

here code :

 nsregularexpression *regex2 = [nsregularexpression regularexpressionwithpattern:@"●"                                    options:kniloptions error:nil];  [regex2 enumeratematchesinstring:puretext options:kniloptions range:range usingblock:^(nstextcheckingresult *result, nsmatchingflags flags, bool *stop) {     nsrange substringrange = [result rangeatindex:0];     [stringtext addattribute:nsforegroundcolorattributename value:[uicolor orangecolor] range:substringrange]; }];  _textview.attributedtext = stringtext; 

this code finds , changes ● character's color .

use regex ●.* match characters after dot before newline:

nsregularexpression *regex2 = [nsregularexpression regularexpressionwithpattern:@"●.*"                                    options:kniloptions error:nil];  [regex2 enumeratematchesinstring:puretext options:kniloptions range:range usingblock:^(nstextcheckingresult *result, nsmatchingflags flags, bool *stop) {     nsrange substringrange = [result rangeatindex:0];     [stringtext addattribute:nsforegroundcolorattributename value:[uicolor orangecolor] range:substringrange]; }];  _textview.attributedtext = stringtext; 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -