Get repetition of a string in Julia - repeat() Method Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The repeat() is an inbuilt function in julia which is used to return a string which is the repetition of specified string with specified number of times. Syntax: repeat(String::AbstractString, r::Integer) Parameters: String: Specified string or character r::Integer: Specified number of times Returns: It returns a string which is the repetition of specified string with specified number of times. Example 1: Python # Julia program to illustrate # the use of String repeat() method # Create a repetition of string "gfg" # with 3 times of repetition. println(repeat("gfg", 3)) # Create a repetition of character "a" # with 4 times of repetition. println(repeat("a", 4)) # Create a repetition of string "Geeks" # with 2 times of repetition. println(repeat("Geeks", 2)) # Create a repetition of string "@#" # with 3 times of repetition. println(repeat("@#", 3)) Output: gfggfggfg aaaa GeeksGeeks @#@#@# Example 2: Python # Julia program to illustrate # the use of String repeat() method # Create a repetition of string "123" # with 3 times of repetition. println(repeat("123", 3)) # Create a repetition of string "22" # with 4 times of repetition. println(repeat("22", 4)) # Create a repetition of string "03210" # with 2 times of repetition println(repeat("03210", 2)) Output: 123123123 22222222 0321003210 Comment More infoAdvertise with us Next Article Reverse a string in Julia - reverse() Method K Kanchan_Ray Follow Improve Article Tags : Julia Similar Reads Get repetition of strings in Julia - ^ operator The ^ is an operator in julia which is used to repeat the specified string with the specified number of times. Syntax: ^(s::Union{AbstractString, AbstractChar}, n::Integer) Parameters:  s::Union{AbstractString, AbstractChar}: Specified strings or charactersn::Integer: Specified integer Returns: I 1 min read Get size of string in Julia - sizeof() Method The sizeof() is an inbuilt function in julia which is used to return the size of the specified string i.e, returned size will be equal to the number of code units in the string multiplied by the size (in bytes) of one code unit. Syntax: sizeof(str::AbstractString) Parameters: s::AbstractString: Spec 1 min read Reverse a string in Julia - reverse() Method 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: Python # Julia program to illustrate # the 1 min read Replace a substring with another string in Julia - replace() Method The replace() is an inbuilt function in julia that is used to replace a word or character with the specified string or character. Syntax: replace(s::AbstractString, pattern=>Word; count::Integer) Parameters:  s::AbstractString: Specified string.pattern=>Word: Pattern is searched from the gi 1 min read Get length of a string in Julia - length() Method The length() is an inbuilt function in julia which is used to return the length of the specified string with desired starting and end position. Syntax: length(S::AbstractString) or length(S::AbstractString, i::Integer, j::Integer) Parameters: S::AbstractString: Specified string i::Integer: Inclusive 2 min read Creating array with repeated elements in Julia - repeat() Method The repeat() is an inbuilt function in julia which is used to construct an array by repeating the specified array elements with the specified number of times. Syntax: repeat(A::AbstractArray, counts::Integer...) or repeat(A::AbstractArray; inner, outer) or repeat(s::AbstractString, r::Integer) or re 2 min read Like