這個reverse()
是 julia 中的一個內置函數,用於返回指定字符串的反向。
用法:
reverse(s::AbstractString)
參數:
- a::抽象字符串:指定字符串
返回值:它返回指定字符串的反向。
範例1:
# Julia program to illustrate
# the use of String reverse() method
# Getting the reverse of the specified string
println(reverse("GFG"))
println(reverse("gfg"))
println(reverse("Geeks"))
println(reverse("GeeksforGeeks"))
輸出:
GFG gfg skeeG skeeGrofskeeG
範例2:
# Julia program to illustrate
# the use of String reverse() method
# Getting the reverse of the specified string
println(reverse("123"))
println(reverse("5"))
println(reverse("@#"))
println(reverse("^&*"))
輸出:
321 5 #@ *&^
相關用法
- Julia string()用法及代碼示例
- Julia sizeof()用法及代碼示例
- Julia findlast()用法及代碼示例
- Julia length()用法及代碼示例
- Julia repeat()用法及代碼示例
- Julia SubString()用法及代碼示例
- Julia findfirst()用法及代碼示例
- Julia replace()用法及代碼示例
- Julia startswith()用法及代碼示例
- Julia endswith()用法及代碼示例
- Julia first()用法及代碼示例
- Julia last()用法及代碼示例
- Julia join()用法及代碼示例
- Julia chop()用法及代碼示例
- Julia chomp()用法及代碼示例
- Julia findnext()用法及代碼示例
注:本文由純淨天空篩選整理自Kanchan_Ray大神的英文原創作品 Reverse a string in Julia – reverse() Method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。