Advertisement
JademusSreg

Format Utilities

Dec 26th, 2011
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.95 KB | None | 0 0
  1. //============================================================
  2. //
  3. // FORMAT STRING AND TEXT
  4. //
  5. //============================================================
  6. string c_formatWordStr = "@@@@";
  7. string c_formatStartStr = "<s val=\""+c_formatWordStr+"\">";
  8. string c_formatEndStr = "</s>";
  9. text c_formatWordTxt = StringToText(c_formatWordStr);
  10. text c_formatStartTxt = StringToText(c_formatStartStr);
  11. text c_formatEndTxt = StringToText(c_formatEndStr);
  12. //============================================================
  13. // Format Style Tags
  14. //
  15. string FormatStyleStr (string format)
  16. {
  17.     return StringReplaceWord(c_formatStartStr,c_formatWordStr,format,c_stringReplaceAll,false);
  18. }
  19. text FormatStyleTxt (text format)
  20. {
  21.     return TextReplaceWord(c_formatStartTxt,c_formatWordTxt,format,c_stringReplaceAll,false);
  22. }
  23. //============================================================
  24. // Format String to styled String with String tag
  25. //
  26. string FormatSSS (string source, string format)
  27. {
  28.     return FormatStyleStr(format)+source+c_formatEndStr;
  29. }
  30. //============================================================
  31. // Format String to styled Text with String tag
  32. //
  33. text FormatSTS (string source, string format)
  34. {
  35.     return StringToText(FormatStyleStr(format)+source+c_formatEndStr);
  36. }
  37. //============================================================
  38. // Format String to styled Text with Text tag
  39. //
  40. text FormatSTT (string source, text format)
  41. {
  42.     return FormatStyleTxt(format)+StringToText(source)+c_formatEndTxt;
  43. }
  44. //============================================================
  45. // Format Text to styled Text with String tag
  46. //
  47. text FormatTTS (text source, string format)
  48. {
  49.     return FormatStyleTxt(StringToText(format))+source+c_formatEndTxt;
  50. }
  51. //============================================================
  52. // Format Text to styled Text with Text tag
  53. //
  54. text FormatTTT (text source, text format)
  55. {
  56.     return FormatStyleTxt(format)+source+c_formatEndTxt;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement