I can break the string using the following code:
String str1 = "TEST1"; // length = 5 String str2 = "TEST2"; // length = 5 TextView textView = (TextView)findViewById( R.id.text_view ); textView.setText(str1 + '\n' + str2);
But the final length of the text is 11.
Question:
Is there any special character or method that will allow me to achieve the same result inside my TextView without increasing the length of the text?
What I'm trying to achieve:
I have a data format that is stored in JSON. He looks like
[{type: line, params: {line params}}, {type: text, params: {text params}, ...]
There is always a line at the beginning
Each paragraph begins with a line (therefore, it acts as a line separator, which is stored at the beginning of the line, not at the end)
The size of each line is 1, that is, each line is considered a single character
Each paragraph ends with the text of the last character (not '\ n')
There are some line parameters (e.g. BulletList, Numeric list, Paragraph)
I need a strict comparison between my TextView and the source data, i.e. for each cursor position in my TextView I need to calculate how many characters precede the original data.
user2281646
source share