Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Range Operator for Base62 Encoding

Tags:

f#

For base 62 encoding, I need all 62 alphanumeric characters. The F# range operator offers a nice shorthand for this.

let alphaNumericCharacters =
    seq {
        yield! [|'a'..'z'|]
        yield! [|'A'..'Z'|]
        yield! [|'0'..'9'|]
    } |> Array.ofSeq

This is nice and concise, but I'm greedy. Is there a way of doing this in one line?

like image 566
Rob Lyndon Avatar asked Jul 06 '26 17:07

Rob Lyndon


1 Answers

let alphaNumericCharacters = Array.concat [| [|'0'..'9'|]; [|'A'..'Z'|]; [|'a'..'z'|] |]
like image 56
ildjarn Avatar answered Jul 10 '26 16:07

ildjarn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!