Swapping nibbles range style
MrSmith
mrsmith33 at yandex.ru
Tue Dec 10 14:20:52 PST 2013
On Tuesday, 10 December 2013 at 22:08:17 UTC, Volcz wrote:
> Hi!
> As a small exercise I've been trying to implement a nibble
> swapping method which utilizes D's ranges.
>
> I received some help from eco on #d but still couldn't complete
> it.
> his contribution: http://dpaste.dzfl.pl/f228d0a8
>
> Example:
> Input 1234
> Output 2143
>
> This is going to be used to build a small utility program which
> can be used "echo 1234 | nibbleswap"
>
> Help is appreciated!
Can you explain a bit more. It's unclear what is the exact
problem.
Is it intended to work with unicode strings of any length? Simply
swap pairs of chars? What if string length is odd?
More information about the Digitalmars-d-learn
mailing list