Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

50 Zeilen
892 B

  1. using System;
  2. using ArabicSupport;
  3. namespace UPersian.Utils
  4. {
  5. public static class UPersianUtils
  6. {
  7. public static string RtlFix(this string str)
  8. {
  9. for (int i = 0; i < 10; i++)
  10. {
  11. str = str.Replace(i.ToString()[0], UPersianUtils._persianNumbers[i]);
  12. }
  13. str = str.Replace('ی', 'ﻱ');
  14. str = str.Replace('ک', 'ﻙ');
  15. str = ArabicFixer.Fix(str, false, false);
  16. str = str.Replace('ﺃ', 'آ');
  17. return str;
  18. }
  19. public static bool IsRtl(this string str)
  20. {
  21. bool result = false;
  22. foreach (char c in str)
  23. {
  24. if ((c >= '؀' && c <= 'ۿ') || (c >= 'ﹰ' && c <= ''))
  25. {
  26. result = true;
  27. break;
  28. }
  29. }
  30. return result;
  31. }
  32. private static readonly char[] _persianNumbers = new char[]
  33. {
  34. '۰',
  35. '١',
  36. '۲',
  37. '۳',
  38. '۴',
  39. '۵',
  40. '۶',
  41. '۷',
  42. '۸',
  43. '۹'
  44. };
  45. }
  46. }