Splitting string into array of substrings in Julia - split() and rsplit() Method Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The split() is an inbuilt function in julia which is used to split a specified string into an array of substrings on occurrences of the specified delimiter(s). Syntax: split(str::AbstractString, dlm; limit::Integer, keepempty::Bool) or split(str::AbstractString; limit::Integer, keepempty::Bool) Parameters: str::AbstractString: Specified string. Dlm: Specified delimiter. Below arguments are optional: limit::Integer: It is the maximum size of the result. It's default value is zero (0). keepempty::Bool: It says whether the empty fields should be kept in the result or not. Its Default value is false. Returns: It returns an array of substrings of the specified string. Example: Python # Julia program to illustrate # the use of String split() method # Splitting of the specified strings Println(split("Gee.ks", ".")) Println(split("Geeks, for, Geeks", ", ")) Println(split("GFG-gfg", "-", limit = 1)) Println(split("GFG-gfg", "-", limit = 2)) Output: String rsplit() method rsplit() method works exactly like split() method but starting from the end of the string. Syntax: rsplit(s::AbstractString; limit::Integer, keepempty::Bool) or rsplit(s::AbstractString, chars; limit::Integer, keepempty::Bool) Parameters: str::AbstractString: Specified string. chars: Specified characters. Below arguments are optional: limit::Integer: It is the maximum size of the result. It's default value is zero (0). keepempty::Bool: It says whether the empty fields should be kept in the result or not. Its Default value is false. Returns: It returns an array of substrings of the specified string. Example: Python # Julia program to illustrate # the use of String rsplit() method # Splitting of the specified strings Println(rsplit("Gee.ks", ".")) Println(rsplit("Geeks, for, Geeks", ", ")) Println(rsplit("GFG-gfg", "-"; limit = 1)) Println(rsplit("GFG-gfg", "-"; limit = 2)) Println(rsplit("G-F-G-g-f-g", "-"; limit = 4)) Output: Comment More infoAdvertise with us Next Article Replace a substring with another string in Julia - replace() Method K Kanchan_Ray Follow Improve Article Tags : Julia Similar Reads Join an array of strings into a single string in Julia - join() Method The join() is an inbuilt function in julia that is used to join an array of strings into a single string. The specified delimiter is used to insert in between the returned strings. Syntax: join([io::IO, ] strings, delim, last) Parameters: [io::IO, ] strings: Specified string.delim: Specified deli 1 min read Get a substring of specific size from starting of a string in Julia - first() Method The first() is an inbuilt function in julia which is used to return a string consisting of the first n characters of the specified string, where n will be passed as parameter. Syntax: first(s::AbstractString, n::Integer) Parameters: s::AbstractString: Specified string. n::Integer: Specified integer 1 min read Get a substring of specified length from a string in Julia - SubString() Method The SubString() is an inbuilt function in julia which is used to return a part of the specified parent string s within range i:j or r, where i, j and r is given as the parameter. Syntax: SubString(string::AbstractString, i::Integer, j::Integer) or SubString(string::AbstractString, r::UnitRange) Para 2 min read Get a substring of specific size from end of a string in Julia - last() Method The last() is an inbuilt function in julia which is used to return a string consisting of the last n characters of the specified string, where n will be passed as parameter. Syntax: last(s::AbstractString, n::Integer) Parameters: s::AbstractString: Specified string. n::Integer: Specified integer val 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 Remove starting and ending characters of string in Julia - chop() Method The chop() is an inbuilt function in julia which is used to remove the last character from the specified string. If this function use head and tail parameter, it removes the specified number of first head and the last tail characters from the string. Syntax: chop(s::AbstractString, head::Integer, ta 1 min read Like