[Julia] 02. Strings
Strings How to get a string String interpolation String concatenation How to get a string
「」または「」を使用してstringを入力できます.
「」は文字を定義します.
String interpolation
stringに変数を追加し、式に$を使用します.
I have 10 fingers and 10 toes.
String concatenation
string()または*を使用して文字列を組み合わせることができます.
「」または「」を使用してstringを入力できます.
s1 = "I am a string."
"I am a string."s2 = """I am also a string."""
"I am also a string.""single quotation 안에는 "single quotation"를 넣을 수 없다."
syntax: cannot juxtapose string literal"""triple quotation 안에는 "single quotation"을 넣을 수 있다. """
三重オファーには「単オファー」を加えることができます.「」は文字を定義します.
typeof('a')
Char'string을 표현할 수 없다.'
syntax: character literal contains multiple charactersString interpolation
stringに変数を追加し、式に$を使用します.
name = "Jane"
num_fingers = 10
num_toes = 10
10println("hello, my name is $name.")
println("I have $num_fingers fingers and $num_toes toes.")
hello, my name is Jane.I have 10 fingers and 10 toes.
println("That is $(num_fingers + num_toes) digits in all!!")
That is 20 digits in all!!String concatenation
string()または*を使用して文字列を組み合わせることができます.
s3 = "How many cats "
s4 = "is too many cats?"
😺 = 10
10string(s3, s4)
"How many cats is too many cats?"string("I don't know, but ", 😺, " is too few.")
"I don't know, but 10 is too few."s3 * s4
"How many cats is too many cats?"a = 3
b = 4
4c = "$a + $b"
"3 + 4"d = "$(a + b)"
"7"Reference
この問題について([Julia] 02. Strings), 我々は、より多くの情報をここで見つけました https://velog.io/@hamdoe/Julia-02.-Stringsテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol