I have the following string in TextMeshPro: "<style=Title>This is a Title (...)".
I would like to translate the StyleTag to the defined Opening Tags. For this example it would translate the string above to the following: "<size=125%><align=center>This is a Title (...)".
How can I do this?
You can get the OpeningTags to a StyleTag by calling the following function: TMP_StyleSheet.GetStyle("[StyleName]").styleOpeningDefinition (with TMP_StyleSheet being a reference to the used TMP-StyleSheet).
So a possible solution is to extract the StyleName from your string (e.g. "(...text) <style=Example> (text...)" would become "Example") and feed it to the function above. Regular Expressions can help to extract the StyleName from your string. Then replace the whole tag with whatever the function returns (e.g. "<size=125%>"). (Note: It returns Null if the tag does not exist). Then do the same with the closing tag.