Extracting Bytes From A F# String
[F#, Tips]
Suppose you need to extract the byte values of a string in F#
An obvious way is to use the Encoding
class from System.Text
Like so:
open System.Text
let bytes = Encoding.Default.GetBytes("This Is My String")
printfn "%A" bytes
An even quicker way to to it natively is as follows:
printfn "%A" "This Is My String"B
Note the B at the end
The code is in my github
Happy hacking!