QA@IT
«回答へ戻る

回答を投稿

PowerShellでよければ、こんな感じでいかがでしょうか。

$ary_names = "aaa_bbb_ccc.txt"

$idx = -1
$counter = 0

while($TRUE){
    $idx = $ary_names.IndexOf( '_', $idx + 1)

    if($idx -ne -1){
        $counter ++
        $tmp = $ary_names.Substring($idx+1, 1).ToUpper()
        $ary_names = $ary_names.Remove($idx+1,1)
        $ary_names = $ary_names.Insert($idx+1,$tmp)
    }else{
        break
    }
}
write-host $ary_names
PowerShellでよければ、こんな感じでいかがでしょうか。

```powershell
$ary_names = "aaa_bbb_ccc.txt"

$idx = -1
$counter = 0
 
while($TRUE){
    $idx = $ary_names.IndexOf( '_', $idx + 1)
    
    if($idx -ne -1){
        $counter ++
        $tmp = $ary_names.Substring($idx+1, 1).ToUpper()
        $ary_names = $ary_names.Remove($idx+1,1)
        $ary_names = $ary_names.Insert($idx+1,$tmp)
    }else{
        break
    }
}
write-host $ary_names
```