Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: String to Byte array

by BrowserUk (Pope)
on Sep 19, 2013 at 16:42 UTC ( #1054881=note: print w/replies, xml ) Need Help??

in reply to String to Byte array

That usage of Convert.ToByte( string, 16 ) converts a 2-digit hex string to an unsigned 8-bit integer.

The direct equivalent in Perl would be unpack 'H2', substr $key, $i*2, 2;.

But then you'll need to convert that integer into a character and pack it back into a string.

But, you have a bigger problem if your example "AJDAHSDJ213718327DSFSDJFHSDKFJ87348171837" is obtained from somewhere rather than just made up? J, K, H & S are not hex digits.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: String to Byte array
by toolic (Bishop) on Sep 19, 2013 at 16:51 UTC
    J, K, H & S are not hex digits.
    Maybe they're kpaxadecimal :) </lame>
Re^2: String to Byte array
by kpaxian25 (Novice) on Sep 20, 2013 at 21:12 UTC
    Yes that was just made up text. Didn't realize about the J,K,H&S.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1054881]
[marto]: that is to say, to the best of my knowledge, they never did.
[marto]: they have a commercial product called perlapp
[mark4]: Do you h=know how I can get pp.exe? Is there a module I can install that includes this?
[marto]: I always found Strawberry Perl on windows to be a much better environment, made life much easier
[marto]: pp. install it like you would any other module
[marto]: it probably exists in one of the PPM repositories
[marto]: failing that see the README
[mark4]: I installed "PAR" from the ppm install window. pp.exe. did not show up.

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (13)
As of 2018-01-19 14:11 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (218 votes). Check out past polls.