- 내가 원하는 것
- 파이썬처럼 f"{variable_name}" + "HI" + " " 하기
OCAML Tutorial 18/33: The String Module in OCAML - YouTube
# String.length "String";;
- : int = 6
# let s = "we are checking the String module";;
val s : string = "we are checking the String module"
# String.length s;;
- : int = 33
# String.sub s 3 3 ;;
- : string = "are"
# String.sub s 3 12;;
- : string = "are checking"
# "this"^" "^"is";;
- : string = "this is"
# let l = ["this";"is";"a"];;
val l : string list = ["this"; "is"; "a"]
# String.concat " " l;;
- : string = "this is a"
# let s = String.concat " " l;;
val s : string = "this is a"
# String.iter (fun x -> print_char x) s;;
this is a- : unit = ()
# String.map (fun x -> Char.uppercase_ascii x) s;;
- : string = "THIS IS A"
# open String;;
# open Char;;
# uppercase_ascii 'c';;
- : char = 'C'
# let s2upper = String.uppercase_ascii;;
val s2upper : string -> string = <fun>
# s2upper "test";;
- : string = "TEST"
'Computer Science > 프로그래밍언어' 카테고리의 다른 글
Data Structure | Zipper Tree (feat. 함수형 언어) (0) | 2022.03.25 |
---|---|
TDD( Test Driven Development )이란? (0) | 2022.03.24 |
OCaml 함수 예제 (0) | 2022.03.09 |
OCaml Tutorial | Recursion with Lists (0) | 2022.03.08 |
OCaml Tutorial | Introduction to Lists (0) | 2022.03.08 |