I know that parts of a label's text can have different colors. This is done via csbuilder.
But how can I change the color of a certain word, which beforehand is not known, but will be set later by the user?
The structure of a solution could be:
B4X:
Dim text as String = "big problems need big solutions"
Dim word as String = "big" 'is set by user during runtime
Dim colored_text as CSBuilder = ColorChange(text, word, "red")
label.text = colored_text
However, the question is: How can I realize ColorChange?
B4A v6.80 adds several new features related to the ability to format rich strings. CharSequence is a native interface in Android SDK. A String is one implementation of CharSequence. There are other implementations of CharSequence that provide more features and allow us to format the string...
Of course I know this tutorial, Manfred. But it doesn't solve my problem.
Maybe I was not clear enough: The part of the label's text, which will have a different color, is not known beforehand. The user, when running the code, should be able to select a word which then is displayed in a different color.
Okay, I can use Regex.Split with the user's word as split parameter and then put it together like: part1 + word + part2.
My hope was, that a more elegant method would exist.