Android convert string to integer and integer to string

aide ide tutorials

This is a basic tutorials, but this is very important when you want to convert your character data type.

For string to integer you can use this following codes
String et = "1233545";
int xx  = Integer.parseInt(et);
Output x = 1233545

String s="your1string2contain3with4number";
int i=Integer.parseInt(s.replaceAll("[\D]", ""));
Output i = 1234

int i=Integer.parseInt("hello123".replaceAll("[\D]",""));
Output i = 122

String str = "123" ;
int i = Integer.parse(str);
Output i = 123

Now lets move to integer to string.
int i = 5;
String strI = String.valueOf(i);
Output strl ="5";

Done.

Comments

Popular posts from this blog

Implement in-app purchase in aide ide

Implement google admob interstitial ads in aide ide

Implement a-ads on blogger or website

Android play .gif file on imageview in aide ide

Aide ide tutorial - Add line graph


Malitanyo Developer blog & tutorial 2020
Refund Policy    Facebook Page    Google Play

Blogger.com