Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Names = @{
- Willem = 'Van Oranje'
- Jan = 'van de Vecht'
- Piet = 'Paulusma'
- }
- ForEach ($Row in $Names.GetEnumerator()) {
- $LastnameIndex = $Row.Value.LastIndexOf(' ')
- If ($LastnameIndex -lt 1) {
- $LastName = $Row.Value
- }
- $LastName = $Row.Value.Substring($LastnameIndex+1)
- $Username = $Row.Name.Substring(0,1) + $LastName
- Write-Output $Username
- }
Add Comment
Please, Sign In to add comment