Open In App

Convert an Integer to a String in Julia - string() Function

Last Updated : 28 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

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
# Julia program to illustrate 
# the use of String string() method
 
# Conversion of integer to a string
# in the given base
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
# Julia program to illustrate 
# the use of String string() method
 
# Creation of a single string using
# all the arguments 
Println(string("A", 5, true))
Println(string("A", 10, false))
Println(string("B", 6, true))
Println(string("C", 12, false))

Output: 
 


 


Next Article
Article Tags :

Similar Reads