iOS Question Putting something in string

mare1980k1

Member
Licensed User
Longtime User
Hello,
I have string called s1 = "1234567890" and, on click of a button, i want to put "A" between 1 and 2 (user can select if it's gonna be between 1 and 2 or between 6 and 7, so i guess i have to use selectionstart).
Next time, when user clicks that button again (without touching the selection) i want to put "B". So, for example if the user selects between 7 and 8 and clicks once, it should write "A" between 7 and 8. When user clicks again without touching the selection it should be "1234567AB890".
I've been trying it for some time now, and it alkways makes the selection on 0 after i add "A".
Any help?
 
Top