프로그래밍/Boo
스트링 배열 정렬(sorting)하기 for .NET with Boo
Scripter
2009. 4. 20. 22:47
[파일명: testSort.boo]------------------------------------------------
import System
import System.Collections
def printArray(arr as Array):
Console.Write("[")
for i in range(0, len(arr) - 1):
s = "${arr[i]}, "
Console.Write(s)
if len(arr) > 0:
Console.Write("{0}", "${arr[len(arr) - 1]}")
Console.WriteLine("]")
arr = array(String, argv.Length)
for i in range(0, argv.Length):
arr[i] = argv[i]
Array.Sort(arr)
printArray(arr)
------------------------------------------------
실행> booi testSort.boo one two thee four five
[five, four, one, three, four]
실행> booi testSort.boo 하나 둘 셋 넷 다섯
[넷, 다섯, 둘, 셋, 하나]