if(account. > logamount.){
addActionError("Input amount beyond the original one ");
return INPUT;
}account和logamount都是字符串类型,我现在要比较数字。我想问问怎么换成数字类型比较?应该account.   logamount. 什么方法?

解决方案 »

  1.   

    字符串转换数字比较,account. > logamount.  这里应该怎么转换成数字比较..点什么方法?
      

  2.   


    int a = Integer.parseInt(account);先转换吧,不过要确定accout是数字, 先判断下吧。
      

  3.   

    是数字,定义时候是字符串
    private String account;
    private String logamount;
    现在就要判断account,logamount。。不知道怎么转换数字进行比较。
    if(account. > logamount.){ 
    addActionError("Input amount beyond the original one "); 
    return INPUT; 

    里面点什么方法?还是按照楼上大哥说的先转换?
      

  4.   

    如果是数字字符串,将转换为int再比较,String转int方法:int=Integer.parseInt("字符串");
      

  5.   

    [align=center]
       int a = "11111"+0;
       String b = 11111+"";
       这样也可以转换的
    [/align]