-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtensions.fs
41 lines (36 loc) · 1.39 KB
/
Extensions.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
module Srp.Extensions
module Any =
let toString (any : 't) =
any.ToString()
module Array =
let removeFirstIf (element : 't) (elements : 't[]) =
match Array.head elements with
| e when e = element -> Array.tail elements
| e -> elements
module String =
open System.Text
let toLower (sValue : string) =
sValue.ToLower()
let replace oldValue (replacement: string) (sValue : string) =
sValue.Replace(oldValue, replacement)
let trimStart (trimmedChar : char) (sValue : string) =
sValue.TrimStart(trimmedChar);
let getBytesUTF8 (sValue : string) =
sValue
|> Encoding.UTF8.GetBytes
module Regex =
open System.Text.RegularExpressions
let replace pattern (replacement: string) (value : string) =
Regex.Replace(value, pattern, replacement)
module BigInteger =
open System.Globalization
open System.Numerics
open System
let getBytes (bigInt : BigInteger) =
bigInt.ToByteArray()
let modPow exp modulus value =
BigInteger.ModPow(value, exp, modulus)
let parse (style:NumberStyles) value =
BigInteger.Parse(value, style)
let multiply multiplyer value =
BigInteger.Multiply(multiplyer, value)