프로그래밍/F#
문자열 거꾸로 하기 with F#
Scripter
2010. 7. 15. 18:38
▒ F# 소스: TestStringReverse.fs
#light
let a = "Hello, world!"
let b = "안녕하세요?"
let mutable arr = a.ToCharArray()
arr <- Array.rev arr
System.Console.WriteLine(new System.String(arr))
arr <- b.ToCharArray()
arr <- Array.rev arr
System.Console.WriteLine(new System.String(arr))
(*
Expected result:
!dlrow ,olleH
?요세하녕안
*)
주: 한글이 출력되어야 하므로 fsc 명령으로 컴파일시 옵션 --codepage:949 를 추가한다.