Skip to content
Related Articles

Related Articles

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

The startswith() is an inbuilt function in julia which is used to return true if the specified string start with the specified prefix else return false.

Syntax:
startswith(s::AbstractString, prefix::AbstractString)

Parameters:

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

Returns: It returns true if the specified string start with the specified prefix else return false.

Example 1:






# Julia program to illustrate 
# the use of String startswith() method
  
# Checking starting part of string with 
# specified prefix value
println(startswith("Geeks", "Geek"))
println(startswith("GeeksforGeeks", "G"))
println(startswith("GFG", "GFG"))

Output:

true
true
true

Example 2:




# Julia program to illustrate 
# the use of String startswith() method
  
# Checking starting part of string with 
# specified prefix value
println(startswith("Geeks", "ks"))
println(startswith("GeeksforGeeks", "forGeeks"))
println(startswith("GFG", "gfg"))

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 :