Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. init()
  2. {
  3. level.russian_down = "абвгдежзийклмнопрстуфхцчшщъыьэюя";
  4. level.russian_up = "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ";
  5. }
  6.  
  7. isUpperChar(c)
  8. {
  9. asc = getAscii(c);
  10. if (asc < -32 && asc >= -64)
  11. return true;
  12. return false;
  13. }
  14.  
  15. toLowerChar(c)
  16. {
  17. if (isUpperChar(c))
  18. {
  19. asc = getAscii(c);
  20. return level.russian_down[asc+64];
  21. }
  22. else
  23. return c;
  24. }
  25.  
  26. toLower(str)
  27. {
  28. newstr = "";
  29. for (i=0; i<str.size; i++)
  30. {
  31. newstr += toLowerChar(str[i]);
  32. }
  33. return newstr;
  34. }
  35.  
  36. isRussianPlayer()
  37. {
  38. if (!isdefined(self.country_code))
  39. {
  40. printf("self.country_code is not defined \n");
  41. return false;
  42. }
  43.  
  44. if (self.language == 6 ||
  45. self.country_code == "RU" ||
  46. self.country_code == "LV" ||
  47. self.country_code == "UA" ||
  48. self.country_code == "KZ" ||
  49. self.country_code == "BY")
  50. {
  51. return true;
  52. }
  53. else
  54. {
  55. return false;
  56. }
  57. }
  58.  
  59. isRussianText(text)
  60. {
  61. count = 0;
  62. for (i=0; i<text.size; i++)
  63. {
  64. asc = getAscii(text[i]);
  65. if (asc <= -1 && asc >= -64)
  66. count++;
  67. }
  68. if (count > int(text.size/2))
  69. return true;
  70. else
  71. return false;
  72. }
  73.  
  74. stringIsCommonCharsOnly(str)
  75. {
  76. good = "1234567890!@#$%^&*()-_=+qwertyuiop[]QWERTYUIOP{}\|asdfghjkl;'ASDFGHJKL:zxcvbnm,./ZXCVBNM<>?йцукенгшщзхъфывапролджэячсмитьбюЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ";
  77. count = 0;
  78. for (i=0; i<str.size; i++)
  79. {
  80. for (j=0; j<good.size; j++)
  81. {
  82. if (str[i] == good[j])
  83. {
  84. count++;
  85. break;
  86. }
  87. }
  88. }
  89. return count;
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement