flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Windows > String reverse

Author
Thread Post new topic Reply to topic
Andy



Joined: 17 Oct 2011
Posts: 26
String reverse
I tried to search on forum but without any succes, an algorithm to reverse some wide chars. Anyone can point me in the right direction?
Post 03 Dec 2012, 12:40
View user's profile Send private message Reply with quote
nmake



Joined: 13 Sep 2012
Posts: 193
The lazi version is that you convert it to ansi 1252, then reverse it normally, then convert it back to wide chars again. You can use MultiByteToWideChar to convert your widechar string to ansi 1252.

The faster and more complex way is to simply treat each character as 16 bits instead of 8, there is nothing more to it.
Post 03 Dec 2012, 12:58
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
Andy,

"Reverse" in what sense?

Convert to single- or multi-byte encoding? WideCharToMultiByte(), you may want to pre-condition wide string with FoldString() before conversion (ligatures, accented character composites, digits).

Convert to UTF-8? Algorithm is quite straightforward, except for surrogate pairs. WideCharToMultiByte() can be used too.

Maybe just reverse wide chars' order in string? wcsrev() will do that. You can write your implementation also, just don't forget surrogate pairs.
Post 03 Dec 2012, 17:23
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.