Java format using alternative

string sayingTemplateStr = Hello, financial service unit determines vendor account information need to provide the following reason: 
$ {reason}

String colName = "reason"

record.getStr (colName) = "Golden 5 yuan 5"

sayingTemplateStr sayingTemplateStr.replace = ( String.format ( "$ {% s} ", colName), objToString (record.getStr (colName)));


result:
Hello, financial service unit determines vendor account information need to provide for the following reasons:
Golden Retriever 5 yuan 5




/ **
     * Object the security Object toString
     *
     * @param obj
     * Object type object
     * @return STR
     * String type object
     * /
    Private String objToString (Object obj) {
        String STR = "";
        IF (! = null obj)
            STR obj.toString = ();
        return STR;
    }

 

Guess you like

Origin www.cnblogs.com/xiaowoniulx/p/10944441.html