Advertisement
JademusSreg

Text Format (Replace)

Apr 23rd, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.82 KB | None | 0 0
  1. const string TextContentToken = "##TextContentToken##";
  2. const string TextStyleToken = "##TextStyleToken##";
  3. const string TextStyleMarkup  = "<s val=\"##TextStyleToken##\">##TextContentToken##</s>";
  4.  
  5. text TextStyle (text sourceText, string style)
  6. {
  7.     if ((sourceText != null) && (style != null))
  8.     {
  9.         // Replace TextContentToken with sourceText
  10.         sourceText = TextReplaceWord(StringToText(TextStyleMarkup),StringToText(TextContentToken),sourceText,c_stringReplaceAll,true);
  11.         // Replace TextStyleToken with style
  12.         sourceText = TextReplaceWord(sourceText,StringToText(TextStyleToken),StringToText(style),c_stringReplaceAll,true);
  13.     }
  14.     return sourceText;
  15. }
  16.  
  17. text TextColorStyle (text sourceText, color tint, string style)
  18. {
  19.     return TextStyle(TextWithColor(sourceText,tint),style);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement