Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int convertAsciiToIndexNumber(int asciiInt) {
- //for ISO-8859-1 (Latin 1):
- // å = -27
- // ä = -28
- // ö = -10
- //for ASCII
- // å = 134
- // ä = 132
- // ö = 148
- //DONT USE UTF8
- int ret;
- if((asciiInt > 96) && (asciiInt < 123)) { //asciiInt is between a-z
- ret = asciiInt - 96; //makes 'a' = 1... z = 26;
- } else if ((asciiInt == 134) || (asciiInt == (-27))) { //asciiInt is 'å', make it number 27
- ret = 27;
- } else if ((asciiInt == 132) || (asciiInt == (-28))) {//asciiInt is 'ä', make it number 28
- ret = 28;
- } else if ((asciiInt == 148) || (asciiInt == (-10))) {//asciiInt is 'ö', make it number 29
- ret = 29;
- }else { //asciiInt is " " (space), makes it 0.
- ret = 0;
- }
- return ret;
- }
Add Comment
Please, Sign In to add comment