Created
October 4, 2019 13:07
-
-
Save PrateekKumarSingh/2523a6424946cc01e9b78d998a9e67c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Method 9 - From String using `-Match` operator | |
$Hashtable = @{} | |
@" | |
name=prateek | |
age=29 | |
skills=powershell | |
"@ -split [System.Environment]::NewLine | ForEach-Object { | |
if ($_ -match '^(.*)=(.*)'){ | |
$Hashtable[$matches[1]] = $matches[2] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment