九天神皇 > 我的1979 > 15、骂战

15、骂战


请稍后阅读,章节错误

        002

        003

        ;

        004

        ;

        005

        ;

        006

        ;

        007

        ;

        008

        009

        lassreportutil{

        010

        011

        /**

        012

        *格式化日期

        013

        *@paramobj日期对象

        014

        *@paramformat格式化字符串

        015

        *@return

        016

        */

        017

        publicstaticstringformatdate(objectobj,stringformat){

        018

        if(obj==null)

        019

        return““;

        020

        021

        strings=(obj);

        022

        if(format==null||““(())){

        023

        format=“yyyy-mm-dd“;

        024

        }

        025

        try{

        026

        simpledateformatdateformat=newsimpledateformat(format);

        027

        s=(obj);

        028

        }catch(exceptione){

        029

        }

        030

        returns;

        031

        }

        032

        033

        /**

        034

        *格式化数字

        035

        *@paramobj数字对象

        036

        *@paramformat格式化字符串

        037

        *@return

        038

        */

        039

        publicstaticstringformatnumber(objectobj,stringformat){

        040

        if(obj==null)

        041

        return““;

        042

        043

        strings=(obj);

        044

        if(format==null||““(())){

        045

        format=“#00“;

        046

        }

        047

        try{

        048

        if(objinstanceofdouble||objinstanceoffloat){

        049

        if((“%“)){

        050

        numberformatnumberformat=();

        051

        s=(obj);

        052

        }else{

        053

        decimalformatdecimalformat=newdecimalformat(format);

        054

        s=(obj);

        055

        }

        056

        }else{

        057

        numberformatnumberformat=();

        058

        s=(obj);

        059

        }

        060

        }catch(exceptione){

        061

        }

        062

        returns;

        063

        }

        064

        065

        /**

        066

        *计算字符串四则运算表达式

        067

        *@paramstring

        068

        *@return

        069

        */

        070

        publicstaticstringcomputestring(stringstring){

        071

        stringregexcheck=“[\\(\\)\\d\\+\\-\\*/\\]*“;//是否是合法的表达式

        072

        073

        if(!(regexcheck,string))

        074

        returnstring;

        075

        076

        matchermatcher=null;

        077

        stringtemp=““;

        078

        intindex=-1;

        079

        stringregex=“\\([\\d\\\\+\\-\\*/]+\\)“;//提取括号表达式

        080

        string=(“\\s“,““);//去除空格

        081

        try{

        082

        patternpattern=(regex);

        083

        //循环计算所有括号里的表达式

        084

        while((string)()){

        085

        matcher=(string);

        086

        while(()){

        087

        temp=();

        088

        index=(temp);

        089

        string=(0,index)

        090

        +computestirngnobracket(temp)

        091

        +(index+());

        092

        }

        093

        }

        094

        //最后计算总的表达式结果

        095

        string=computestirngnobracket(string);

        096

        }catch(numberformatexceptione){

        097

        ();

        (未完待续。)手机用户请浏览阅读,更优质的阅读体验。


  https://www.biqugecd.cc/5_5983/1658645.html


请记住本书首发域名:www.biqugecd.cc。九天神皇手机版阅读网址:m.biqugecd.cc