Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
1
Task/Reverse-a-string/PowerShell/reverse-a-string-1.psh
Normal file
1
Task/Reverse-a-string/PowerShell/reverse-a-string-1.psh
Normal file
|
|
@ -0,0 +1 @@
|
|||
$s = "asdf"
|
||||
1
Task/Reverse-a-string/PowerShell/reverse-a-string-2.psh
Normal file
1
Task/Reverse-a-string/PowerShell/reverse-a-string-2.psh
Normal file
|
|
@ -0,0 +1 @@
|
|||
[string]::Join('', $s[$s.Length..0])
|
||||
1
Task/Reverse-a-string/PowerShell/reverse-a-string-3.psh
Normal file
1
Task/Reverse-a-string/PowerShell/reverse-a-string-3.psh
Normal file
|
|
@ -0,0 +1 @@
|
|||
-join ($s[$s.Length..0])
|
||||
1
Task/Reverse-a-string/PowerShell/reverse-a-string-4.psh
Normal file
1
Task/Reverse-a-string/PowerShell/reverse-a-string-4.psh
Normal file
|
|
@ -0,0 +1 @@
|
|||
[array]::Reverse($s)
|
||||
3
Task/Reverse-a-string/PowerShell/reverse-a-string-5.psh
Normal file
3
Task/Reverse-a-string/PowerShell/reverse-a-string-5.psh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
$s -replace
|
||||
('(.)' * $s.Length),
|
||||
[string]::Join('', ($s.Length..1 | ForEach-Object { "`$$_" }))
|
||||
3
Task/Reverse-a-string/PowerShell/reverse-a-string-6.psh
Normal file
3
Task/Reverse-a-string/PowerShell/reverse-a-string-6.psh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
$s -replace
|
||||
('(.)' * $s.Length),
|
||||
-join ($s.Length..1 | ForEach-Object { "`$$_" } )
|
||||
1
Task/Reverse-a-string/PowerShell/reverse-a-string-7.psh
Normal file
1
Task/Reverse-a-string/PowerShell/reverse-a-string-7.psh
Normal file
|
|
@ -0,0 +1 @@
|
|||
[Regex]::Matches($s,'.','RightToLeft').Value -join ''
|
||||
3
Task/Reverse-a-string/PowerShell/reverse-a-string-8.psh
Normal file
3
Task/Reverse-a-string/PowerShell/reverse-a-string-8.psh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
$a = 'abc 🐧 def'
|
||||
$enum = $a.EnumerateRunes() | % { "$_" }
|
||||
-join $enum[$enum.length..0] # fed 🐧 cba
|
||||
6
Task/Reverse-a-string/PowerShell/reverse-a-string-9.psh
Normal file
6
Task/Reverse-a-string/PowerShell/reverse-a-string-9.psh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
$a = "aeiou`u{0308}yz"
|
||||
$enum = [System.Globalization.StringInfo]::GetTextElementEnumerator($a)
|
||||
$arr = @()
|
||||
while($enum.MoveNext()) { $arr += $enum.GetTextElement() }
|
||||
[array]::reverse($arr)
|
||||
$arr -join '' # zyüoiea
|
||||
Loading…
Add table
Add a link
Reference in a new issue