📌  相关文章
📜  获取 Julia 中指定字符串模式的最后一次出现 – findlast() 方法

📅  最后修改于: 2022-05-13 01:54:38.512000             🧑  作者: Mango

获取 Julia 中指定字符串模式的最后一次出现 – findlast() 方法

findlast()是 julia 中的一个内置函数,用于返回指定字符串中指定模式的最后一次出现。

示例 1:

# Julia program to illustrate 
# the use of String findlast() method
  
# Here the pattern is "e" and String is
# "geeks"
Println(findlast("e", "geeks"))
  
# Here the pattern is "eek" and String is
# "geeksforgeeks"
Println(findlast("eek", "geeksforgeeks"))
  
# Here the pattern is "s" and String is
# "geeks"
Println(findlast("s", "geeks"))
  
# Here the pattern is "geeks" and String is
# "geeksforgeeks"
Println(findlast("geeks", "geeksforgeeks"))

输出:
示例 2:

# Julia program to illustrate 
# the use of String findlast() method
   
# Here the pattern is "4" and String is
# "2468"
Println(findlast("4", "2468"))
   
# Here the pattern is "234" and String is
# "123452346"
Println(findlast("234", "123452346"))
   
# Here the pattern is "45" and String is
# "14523456"
Println(findlast("45", "14523456"))

输出: