samples/stringtypes.json

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
[
    {
        "MemberType": "AliasProperty",
        "MemberName": "Size",
        "Value": "Length",
        "TypeName": "System.String"
    },
    {
        "MemberType": "ScriptMethod",
        "MemberName": "IsIPAddress",
        "Value": "$this -match \"^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$\"",
        "TypeName": "System.String"
    },
    {
        "MemberType": "ScriptMethod",
        "MemberName": "Reverse",
        "Value": "for ($i=$this.length;$i -ge 0;$i--) {\r\n $reverse=$reverse+$this[$i]\r\n}\r\n$reverse",
        "TypeName": "System.String"
    },
    {
        "MemberType": "ScriptProperty",
        "MemberName": "IsEmail",
        "Value": "$this -match \u0027^\\S+@([\\w-]+)\\.(com|edu|org|net)$\u0027",
        "TypeName": "System.String"
    },
    {
        "MemberType": "ScriptMethod",
        "MemberName": "Randomize",
        "Value": "($this.ToCharArray() | get-random -Count $this.length) -join \"\"",
        "TypeName": "System.String"
    },
    {
        "MemberType": "ScriptMethod",
        "MemberName": "Reverse",
        "Value": "($this.ToCharArray())[-1..-$this.length] -join \"\"",
        "TypeName": "System.String"
    }
]