attributeSubstring
fun String.attributeSubstring(substring: String, attribute: StringStyleAttribute): Pair<StringStyleAttribute, IntRange>?
Looks for a substring in the String and returns a Pair or StringStyleAttribute and IntRange that should be provided to StyledStringBuilder to apply the StringStyleAttribute to the first occurrence of the substring
Return
the Pair of attribute and an IntRange to provide to StyledStringBuilder to apply the StringStyleAttribute to the first occurrence of the substring, or null
if the substring does not occur in the String
Parameters
substring
the substring to find in the String
attribute
the StringStyleAttribute to apply to substring if it is found