21.05.2012, 09:35
Quote:
Что значит транслитеризовать?
Подменить буквы русские? Т.е. букву П на P. А как быть с буквами Й,Ы,Ж,Ч,Ю,Ш,Щ? |
Code:
stock Translate(str[]) { new retstr[512]; for(new i=0;i<strlen(str);i++) { switch(str[i]) { case 'А':strcat(retstr,"A"); case 'Б':strcat(retstr,"B"); case 'В':strcat(retstr,"V"); case 'Г':strcat(retstr,"G"); case 'Д':strcat(retstr,"D"); case 'Е':strcat(retstr,"E"); case 'Ё':strcat(retstr,"Jo"); case 'Ж':strcat(retstr,"Zh"); case 'З':strcat(retstr,"Z"); case 'И':strcat(retstr,"I"); case 'Й':strcat(retstr,"J"); case 'К':strcat(retstr,"K"); case 'Л':strcat(retstr,"L"); case 'М':strcat(retstr,"M"); case 'Н':strcat(retstr,"N"); case 'О':strcat(retstr,"O"); case 'П':strcat(retstr,"P"); case 'Р':strcat(retstr,"R"); case 'С':strcat(retstr,"S"); case 'Т':strcat(retstr,"T"); case 'У':strcat(retstr,"U"); case 'Ф':strcat(retstr,"F"); case 'Х':strcat(retstr,"H"); case 'Ц':strcat(retstr,"C"); case 'Ч':strcat(retstr,"Ch"); case 'Ш':strcat(retstr,"Sh"); case 'Щ':strcat(retstr,"Shh"); case 'Ь':strcat(retstr,"#"); case 'Ы':strcat(retstr,"Y"); case 'Ъ':strcat(retstr,"'"); case 'Э':strcat(retstr,"Je"); case 'Ю':strcat(retstr,"Ju"); case 'Я':strcat(retstr,"Ja"); case 'а':strcat(retstr,"a"); case 'б':strcat(retstr,"b"); case 'в':strcat(retstr,"v"); case 'г':strcat(retstr,"g"); case 'д':strcat(retstr,"d"); case 'е':strcat(retstr,"e"); case 'ё':strcat(retstr,"jo"); case 'ж':strcat(retstr,"zh"); case 'з':strcat(retstr,"z"); case 'и':strcat(retstr,"i"); case 'й':strcat(retstr,"j"); case 'к':strcat(retstr,"k"); case 'л':strcat(retstr,"l"); case 'м':strcat(retstr,"m"); case 'н':strcat(retstr,"n"); case 'о':strcat(retstr,"o"); case 'п':strcat(retstr,"p"); case 'р':strcat(retstr,"r"); case 'с':strcat(retstr,"s"); case 'т':strcat(retstr,"t"); case 'у':strcat(retstr,"u"); case 'ф':strcat(retstr,"f"); case 'х':strcat(retstr,"h"); case 'ц':strcat(retstr,"c"); case 'ч':strcat(retstr,"ch"); case 'ш':strcat(retstr,"sh"); case 'щ':strcat(retstr,"shh"); case 'ъ':strcat(retstr,"#"); case 'ы':strcat(retstr,"y"); case 'ь':strcat(retstr,"'"); case 'э':strcat(retstr,"je"); case 'ю':strcat(retstr,"ju"); case 'я':strcat(retstr,"ja"); case ' ':strcat(retstr," "); case '0':strcat(retstr,"0"); case '1':strcat(retstr,"1"); case '2':strcat(retstr,"2"); case '3':strcat(retstr,"3"); case '4':strcat(retstr,"4"); case '5':strcat(retstr,"5"); case '6':strcat(retstr,"6"); case '7':strcat(retstr,"7"); case '8':strcat(retstr,"8"); case '9':strcat(retstr,"9"); case 'a':strcat(retstr,"a"); case 'b':strcat(retstr,"b"); case 'c':strcat(retstr,"c"); case 'd':strcat(retstr,"d"); case 'e':strcat(retstr,"e"); case 'f':strcat(retstr,"f"); case 'g':strcat(retstr,"g"); case 'h':strcat(retstr,"h"); case 'i':strcat(retstr,"i"); case 'j':strcat(retstr,"j"); case 'k':strcat(retstr,"k"); case 'l':strcat(retstr,"l"); case 'm':strcat(retstr,"m"); case 'n':strcat(retstr,"n"); case 'o':strcat(retstr,"o"); case 'p':strcat(retstr,"p"); case 'q':strcat(retstr,"q"); case 'r':strcat(retstr,"r"); case 's':strcat(retstr,"s"); case 't':strcat(retstr,"t"); case 'u':strcat(retstr,"u"); case 'v':strcat(retstr,"v"); case 'w':strcat(retstr,"w"); case 'x':strcat(retstr,"x"); case 'y':strcat(retstr,"y"); case 'z':strcat(retstr,"z"); case 'A':strcat(retstr,"A"); case 'B':strcat(retstr,"B"); case 'C':strcat(retstr,"C"); case 'D':strcat(retstr,"D"); case 'E':strcat(retstr,"E"); case 'F':strcat(retstr,"F"); case 'G':strcat(retstr,"G"); case 'H':strcat(retstr,"H"); case 'I':strcat(retstr,"I"); case 'J':strcat(retstr,"J"); case 'K':strcat(retstr,"K"); case 'L':strcat(retstr,"L"); case 'M':strcat(retstr,"M"); case 'N':strcat(retstr,"N"); case 'O':strcat(retstr,"O"); case 'P':strcat(retstr,"P"); case 'Q':strcat(retstr,"Q"); case 'R':strcat(retstr,"R"); case 'S':strcat(retstr,"S"); case 'T':strcat(retstr,"T"); case 'U':strcat(retstr,"U"); case 'V':strcat(retstr,"V"); case 'W':strcat(retstr,"W"); case 'X':strcat(retstr,"X"); case 'Y':strcat(retstr,"Y"); case 'Z':strcat(retstr,"Z"); case '!':strcat(retstr,"!"); case '@':strcat(retstr,"@"); case '#':strcat(retstr,"#"); case '$':strcat(retstr,"$"); case '%':strcat(retstr,"%"); case '^':strcat(retstr,"^"); case '&':strcat(retstr,"&"); case '*':strcat(retstr,"*"); case '(':strcat(retstr,"("); case ')':strcat(retstr,")"); case '-':strcat(retstr,"-"); case '_':strcat(retstr,"_"); case '=':strcat(retstr,"="); case '+':strcat(retstr,"+"); case ';':strcat(retstr,";"); case ':':strcat(retstr,":"); case '|':strcat(retstr,"|"); case '[':strcat(retstr,"["); case ']':strcat(retstr,"]"); case '{':strcat(retstr,"{"); case '}':strcat(retstr,"}"); case '.':strcat(retstr,"."); case ',':strcat(retstr,","); case '?':strcat(retstr,"?"); case '/':strcat(retstr,"/"); default: strcat(retstr,str[i]); } } return retstr; }