julia字符串操作示例代码
代码语言:julia
所属分类:其他
代码描述:julia字符串操作示例代码
代码标签: 示例
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
# strings are defined with double quotes # like variables, strings can contain any unicode character s1 = "The quick brown fox jumps over the lazy dog α,β,γ" println(s1) #> The quick brown fox jumps over the lazy dog α,β,γ # println adds a new line to the end of output # print can be used if you dont want that: print("this") #> this print(" and") #> and print(" that.\n") #> that. # chars are defined with single quotes c1 = 'a' println(c1) #> a # the ascii value of a char can be found with Int(): println(c1, " ascii value = ", Int(c1)) #> a ascii value = 97 println("Int('α') == ", Int('α')) #> Int('α') == 945 # so be aware that println(Int('1') == 1) #> false # strings can be converted to upper case or lower case: s1_caps = uppercase(s1) s1_lower = lowercase(s1) println(s1_caps, "\n", s1_lower) #> THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG Α,Β,Γ #> t.........完整代码请登录后点击上方下载按钮下载查看
网友评论0