Guest User

Untitled

a guest
Jul 23rd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. int convertAsciiToIndexNumber(int asciiInt) {
  2. //for ISO-8859-1 (Latin 1):
  3. // å = -27
  4. // ä = -28
  5. // ö = -10
  6.  
  7. //for ASCII
  8. // å = 134
  9. // ä = 132
  10. // ö = 148
  11.  
  12. //DONT USE UTF8
  13.  
  14. int ret;
  15. if((asciiInt > 96) && (asciiInt < 123)) { //asciiInt is between a-z
  16. ret = asciiInt - 96; //makes 'a' = 1... z = 26;
  17. } else if ((asciiInt == 134) || (asciiInt == (-27))) { //asciiInt is 'å', make it number 27
  18. ret = 27;
  19. } else if ((asciiInt == 132) || (asciiInt == (-28))) {//asciiInt is 'ä', make it number 28
  20. ret = 28;
  21. } else if ((asciiInt == 148) || (asciiInt == (-10))) {//asciiInt is 'ö', make it number 29
  22. ret = 29;
  23. }else { //asciiInt is " " (space), makes it 0.
  24. ret = 0;
  25. }
  26. return ret;
  27. }
Add Comment
Please, Sign In to add comment