|
Imports System.Environment
Imports System.IO
Module MyModule
' ********************************************************
' * 実行
' ********************************************************
Sub Main()
' PATH 環境変数取得
Dim strEnv as String = GetEnvironmentVariable( "PATH" )
' 区切り文字定義
Dim delimStr As String = ";"
Dim delimiter As Char() = delimStr.ToCharArray()
' 配列定義
Dim split As String() = Nothing
' トークン分割
split = strEnv.Split( delimiter )
' ソート
Array.Sort( split, split.GetLowerBound(0), split.Length )
Dim strValue as String
' 書き込み
Try
Dim OutFile As StreamWriter = New StreamWriter("result.txt", false )
For each strValue In split
Call OutFile.WriteLine( strValue )
Next
OutFile.Flush()
OutFile.Close()
Catch e As Exception
Console.WriteLine("エラーの内容 : {0}", e.ToString())
End Try
End Sub
End Module
| |