Convert an Integer to a String in Julia – string() Function
Last Updated :
21 Nov, 2021
The string() is an inbuilt function in julia which is used to convert a specified integer to a string in the given base.
Syntax:
string(n::Integer; base::Integer, pad::Integer)
Parameters:
- n::Integer: Specified integer.
- base::Integer: Specified base in which conversion are going to be performed.
- pad::Integer: It is number of characters present in the returned string.
Returns: It returns the converted string in the given base.
Example 1:
Python
Println(string( 10 , base = 5 , pad = 5 ))
Println(string( 10 , base = 5 , pad = 3 ))
Println(string( 5 , base = 10 , pad = 2 ))
Println(string( 8 , base = 9 , pad = 4 ))
|
Output:
:
Example 2:
Python
Println(string( "A" , 5 , true))
Println(string( "A" , 10 , false))
Println(string( "B" , 6 , true))
Println(string( "C" , 12 , false))
|
Output:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...