2
2

More than 1 year has passed since last update.

文字を1文字ずつ配列に格納する(Powershell)

Posted at

Powershellで文字を1文字ずつ配列に格納するスクリプトを実装しました。

    #文字の入力
    $str = Read-Host("文字を入力してください")

    #1文字ずつ分割して配列に格納する
    $str_array = $str.ToCharArray()

    #配列を取り出す
    foreach ($msg in $str_array) {
    	Write-Host $msg
    }
変数.toChararray()

ToCharArray メソッドを使います。

2
2
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2