i'm trying to test out a reversing a string in hebrew and somehow i think one letter is missing.
Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'
Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination
@emaayan
Please NEVER use screenshots instead the code!
yes, i'm aware about code tags, however in this case i wasn't sure if the Hebrew will show up correctly, on other people's screen (i've seen many SO questions with jibbrish when foreign languages were involved) which would defeat the whole point
(i also wanted to show the hover of the ide itself)
Each char of your original
array is 16bit long and consists two bytes. But the logic of your reverse() function is based on one-byte chars. So you reverse it byte by byte rather than char by char.
Look the example:
char original[] = { 0x00, 0x9c, 0x00, 0x95, 0x00, 0x9d};
will be after your reverse() (wrong):
char original[] = { 0x9d, 0x00, 0x95, 0x00, 0x9c, 0x00};
But should be:
char original[] = { 0x00, 0x9d, 0x00, 0x95, 0x00, 0x9c};
Thanks for explaining.
If there was a problem,
you could have used “a b c d” as a placeholder.
there are no other characters I could see that might cause a problem.
the thing is , it reverses them ok, so when i type abcd (in hebrew)
i get
abc (as a result )
that's why i've attached the hover screenshot, the literal string consists of four chars, but when you over above it , it shows what i think is only 3 chars, so i'm wondering if the issue is in the editor and compiler.
Shouldn't you get at least "dcb" ? If you got "abc" as result, it means that your "reverse" do nothing at all.
no i meant AFTER the reverse (think hebrew right to left)
the intent is for "ABCD" to be displayed on the lcd, that's what's is written , without the reverse it would be DCBA, after reverse it's written abc (but only if i write in hebrew)
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.