Apr 17 2019 09:38 AM
Hello,
I tried following PowerShell script and it work well but some how it convert whole string from Upper to lower. i need to keep first letter of string as upper , do not want to cover as lower for first letter.
$a = "E:\User\Staff\cims"
$b = (get-content "$a\staff.csv" -raw)
(("$b").ToLower()).trim(" ") -split (",,") |
Out-File -FilePath E:\User\Staff\cims\staff1.csv -Encoding UTF8 |
Get-Process | Out-Host -Paging| Format-Table -wrap -Property Emp,LastFirst,Last,First,email.title,location
Thank you
Apr 18 2019 12:14 AM
Something like this should do it:
($b[0] + $b.Substring(1).ToLower()).Trim(" ") -split ...
Apr 18 2019 06:49 AM
Thank you!
It is still returning all lower case instead of first letter capital and reset are lower case.
Apr 18 2019 06:53 AM
Fixed through following script,
$TextInfo = (Get-Culture).textinfo
$TextInfo.ToTitleCase($b[0] + $b.Substring(1).ToLower()).Trim(" ") -split(",,") |
Apr 18 2019 09:42 AM
Well it's more fun if you get just the building blocks and do the complete solution yourself 😛 Or in other words I was being lazy and didn't want to copy/paste the entire script sample.