Android: Edittext- get current line

前端 未结 3 1968
说谎
说谎 2021-01-05 20:10

In an edittext is there a method for getting the current line of the cursor? If not I will write my own method, but just wanted to check. If I do write my own method would t

3条回答
  •  攒了一身酷
    2021-01-05 20:55

    find the last index of "\n"using method lastindex=String.lastindexof("\n") then get a substring using method String.substring(lstindex,string.length).and you will get the last line in two lines of code.

提交回复
热议问题