Skip to content
Related Articles

Related Articles

Check if string ends with a specified suffix in Julia – endswith() Method
  • Last Updated : 26 Mar, 2020
GeeksforGeeks - Summer Carnival Banner

The endswith() is an inbuilt function in julia which is used to return true if the specified string ends with the specified suffix value else return false.

Syntax:
endswith(s::AbstractString, suffix::AbstractString)

Parameters:

  • s::AbstractString: Specified string.
  • suffix::AbstractString: Specified suffix value.

Returns: It returns true if the specified string ends with the specified suffix else return false.

Example 1:






# Julia program to illustrate 
# the use of String endswith() method
  
# Checking ending part of string with 
# specified suffix value
println(endswith("Geeks", "ks"))
println(endswith("GeeksforGeeks", "forGeeks"))
println(endswith("GFG", "FG"))

Output:

true
true
true

Example 2:




# Julia program to illustrate 
# the use of String endswith() method
  
# Checking ending part of string with 
# specified suffix value
println(endswith("Geeks", "Geek"))
println(endswith("GeeksforGeeks", "Geek"))
println(endswith("GFG", "GF"))

Output:

false
false
false

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :