Related Articles

Related Articles

Get the last occurrence of the specified string pattern in Julia – findlast() Method
  • Last Updated : 26 Mar, 2020

The findlast() is an inbuilt function in julia which is used to return the last occurrence of the specified pattern in specified string.

Syntax:
findlast(Pattern::AbstractString, String::AbstractString)

Parameters:

  • Pattern: Specified pattern to be searched
  • String: Specified string

Returns: It returns a number in the format of First_number:Second_number. Where first number is the last position of occurrence of the pattern in the specified string whereas second number is the position in the string where the pattern ends.

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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"))

chevron_right


Output:


Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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"))

chevron_right


Output:




My Personal Notes arrow_drop_up
Recommended Articles
Page :