Get the last occurrence of the specified string pattern in Julia – findlast() Method
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:
Println(findlast( "e" , "geeks" ))
Println(findlast( "eek" , "geeksforgeeks" ))
Println(findlast( "s" , "geeks" ))
Println(findlast( "geeks" , "geeksforgeeks" ))
|
Output:
Example 2:
Println(findlast( "4" , "2468" ))
Println(findlast( "234" , "123452346" ))
Println(findlast( "45" , "14523456" ))
|
Output:
Last Updated :
26 Mar, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...