ios - Getting Remaining Text After Selection is Cut -


is there simple way of getting remaining text after selection cut? let me suppose have textview control "hello, jim" in it. if "jim" selected, want store "hello" variable, " without using [textview1 cut:self]. in following code, can other part.

uitextrange *selectedtextrange = textview1.selectedtextrange; nsuinteger location = [textview1 offsetfromposition:textview1.beginningofdocument toposition:selectedtextrange.start]; nsuinteger length = [textview1 offsetfromposition:selectedtextrange.start toposition:selectedtextrange.end]; nsrange selectedrange = nsmakerange(location, length); nsstring *str = [textview1.text substringwithrange:selectedrange]; nslog(@"%@",str); 

of course, that's other part.

thank help.

nsstring *remaining = [textview1.text stringbyreplacingcharactersinrange:textview1.selectedrange withstring:@""]; 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -