Open In App

Reverse a string in Julia – reverse() Method

Improve
Improve
Like Article
Like
Save
Share
Report

The reverse() is an inbuilt function in julia which is used to return the reverse of the specified string.

Syntax:
reverse(s::AbstractString)

Parameters:

  • a::AbstractString: Specified string

Returns: It returns the reverse of the specified string.

Example 1:




# Julia program to illustrate 
# the use of String reverse() method
  
# Getting the reverse of the specified string
println(reverse("GFG"))
println(reverse("gfg"))
println(reverse("Geeks"))
println(reverse("GeeksforGeeks"))


Output:

GFG
gfg
skeeG
skeeGrofskeeG

Example 2:




# Julia program to illustrate 
# the use of String reverse() method
  
# Getting the reverse of the specified string
println(reverse("123"))
println(reverse("5"))
println(reverse("@#"))
println(reverse("^&*"))


Output:

321
5
#@
*&^

Last Updated : 26 Mar, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads