Open In App

Convert a string to uppercase in Julia – uppercase() and uppercasefirst() Methods

The uppercase() is an inbuilt function in julia which is used to return a string with all characters converted to uppercase.

Syntax: uppercase(s::AbstractString)



Parameters:

  • s::AbstractString: Specified string.

Returns: It returns a string with all characters converted to uppercase.



Example:




# Julia program to illustrate 
# the use of uppercase() method
   
# Getting a string with all 
# characters converted to uppercase
println(uppercase("gfg"))
println(uppercase("geeks"))
println(uppercase("geeksforgeeks"))

Output:

GFG
GEEKS
GEEKSFORGEEKS

uppercasefirst

The uppercasefirst() is an inbuilt function in julia which is used to return a string with first character converted to uppercase.

Syntax: uppercasefirst(s::AbstractString)

Parameters:

  • s::AbstractString: Specified string.

Returns: It returns a string with first character converted to uppercase.

Example:




# Julia program to illustrate 
# the use of uppercasefirst() method
   
# Getting a string with first
# character converted to uppercase
println(uppercasefirst("gfg"))
println(uppercasefirst("geeks"))
println(uppercasefirst("geeksforgeeks"))

Output:

Article Tags :