answersLogoWhite

0


Best Answer

There is no one line of code that can convert an array to a different type. A new String array would have to be created and values individually inserted into the array.

Example:

//Assume int[] i has been previously defined

String[] s = new String[i.length];

for(int i=0; i<s.length; i++)

s[i] = ""+i[i];

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

// assume we want to convert an int named some_int to a string

String s = Integer.toString(some_int);

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can you convert from int to string?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you convert an integer to a string?

That really depends on the programming language. In Java, it is sufficient to concatenate it with a String: int myNumber = 5; result = "" + myNumber; Other languages may require a special function, or method, to convert from integer to string.


How do you convert a scanner to string in java?

I assume that your scanner is not scanning a string already, so if you are scanning an int then you can do: for the example you scanner variable is x .... x.intparseString();


What is the puporse of using Val function in Visual basic 6.0?

Val() function is used in Visual Basic 6.0 to convert a string to a numeric value (such as integer, double etc.) or to extract a numeric value out of a string, as illustrated below.Val function as used to convert a string to a numeric valuefor example, let str be a string,Dim str as stringDim int as integerstr="09090"int=val(str)gives int = 9090also, used to extract the numeric part out of a following string,ie. a=val("98ASR_tyui") would give a=98however,b=val("The89")would give b=0 as there is no numeric value preceding the string.


How do you extract digits from an integer in java?

There are different ways to do it. One is to convert it to a String, then use the string manipulations methods to extract individual digits as strings. You can then convert them back to numbers. Another is to do some calculations. For example, to get the last digit: int i = 12345; int lastdigit = i % 10; //To get additional digits, divide by 10 and repeat: i /= 10; int lastdigit = i % 10; In this case you can create a loop for this (repeating while i &gt; 0), and copy the digits to an array.


What can you do to an int that you cannot do to a string in C plus plus?

You can perform arithmetic with it. int x {42}; x *= 2; // ok std::string s {"Hello"}; s *= 2; // error: std::string::operator*= (int) is undefined

Related questions

How do you convert string to int in Java?

One can convert a string variable to an int variable in Java using the parse integer command. The syntax is int foo = Integer.parseInt("1234"). This line will convert the string in the parenthesis into an integer.


How do you convert string to int in net?

int i= Convert.ToInt32("5");


How can someone convert string to int in Java?

To convert string to int in Java, the easiest way is to simply use the method Integer.parseInt(). For more information how to do this, refer to the integer class documents.


How you convert int to string in jsp?

The same way you would in a regular java program. int i = 10; String s = i + ""; after the above line of code the variable s will have "10" as a string value...


How you can convert from string to int in C language?

Use the atoi() or atol() function.


How do you convert an integer int a string through parsing?

int &lt;integerName&gt; = &lt;integerValue&gt;; String &lt;StringName&gt; = Integer.toString(&lt;integerName&gt;); /*where integerName is the name of the integer value, integerValue is the assigned value of the integer, and where StringName is the name of the string holding the parsed integer. */


How do you convert an integer to a string?

That really depends on the programming language. In Java, it is sufficient to concatenate it with a String: int myNumber = 5; result = "" + myNumber; Other languages may require a special function, or method, to convert from integer to string.


How do you convert a scanner to string in java?

I assume that your scanner is not scanning a string already, so if you are scanning an int then you can do: for the example you scanner variable is x .... x.intparseString();


How can you convert from int to string in NET?

lets say you have the following: Dim Int1 as Integer=12 Dim String1 as String 'Very Simple String1=Int1.tostring


What is the puporse of using Val function in Visual basic 6.0?

Val() function is used in Visual Basic 6.0 to convert a string to a numeric value (such as integer, double etc.) or to extract a numeric value out of a string, as illustrated below.Val function as used to convert a string to a numeric valuefor example, let str be a string,Dim str as stringDim int as integerstr="09090"int=val(str)gives int = 9090also, used to extract the numeric part out of a following string,ie. a=val("98ASR_tyui") would give a=98however,b=val("The89")would give b=0 as there is no numeric value preceding the string.


Int a is literal in C language or not?

int a; -- variable definition"int a" -- string literal


How do you extract digits from an integer in java?

There are different ways to do it. One is to convert it to a String, then use the string manipulations methods to extract individual digits as strings. You can then convert them back to numbers. Another is to do some calculations. For example, to get the last digit: int i = 12345; int lastdigit = i % 10; //To get additional digits, divide by 10 and repeat: i /= 10; int lastdigit = i % 10; In this case you can create a loop for this (repeating while i &gt; 0), and copy the digits to an array.