on 11-16-2009 7:54 AM
Hi Experts
I am displaying staff number in a table and the type of this is integer
It is getting displayed with comma seprated value
(for example if staff number is 23567 it is diaplaying 23,567)
I am not getting comma if i convert staff number to string
but to enable table sort i cannot convert this to string
Pls help me how to display integer value without comma in table
Thanks
Karthi D.
Edited by: karthi D on Nov 16, 2009 8:54 AM
Hi Karthi D.
If I understand you correctly you need to do sorting by Integer column, right? If so you it's not necessary to convert the stuff numbers to string. Just sort them as usual Java objects:
public int compareTo(Integer n1, Integer n2) {
return n1.compareTo(n2);
}
BR, Siarhei
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi friend,
You can Also try this hope it will help.
String s1 = "100,000";
String s2 = "";
NumberFormat nf = NumberFormat.getInstance(Locale.getDefault()); // make locale-specific
try
{
int i1 = nf.parse(s1).intValue();
System.out.println(i1+200);
}
catch (ParseException e)
{
e.printStackTrace();
}
}
Regards
Jeetendra.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.