Conversion between a string and an integer

Source: Internet
Author: User

1. How to convert string strings to integer int
int i = Integer.parseint (str);
int i = integer.valueof (my_str). Intvalue ();
Note: The string is converted to double, Float, and long in a similar way.
2. How to convert string strings to integers
Integer integer=integer.valueof (i)
3. How to convert integer int into string string?
Answer: There are three ways:
String s = string.valueof (i);
String s = integer.tostring (i);
String s = "" + I;
Note: Double, Float, Long turn into a string in a similar way.
4. How to convert integer int to integer
Integer integer=new integer (i)
5. How to convert an integer to string
Integer integer=string ()
6. How to convert an integer to int
int Num=integer.intvalue ()
7. How to convert a string to BigDecimal
BigDecimal d_id=new BigDecimal (str)

Conversion between a string and an integer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.