Java在这方面估计做得要好一些。看看时间得格式化 java.text.DateFormatTo format a date for the current Locale, use one of the static factory methods:   myString = DateFormat.getDateInstance().format(myDate);
 
You can use a DateFormat to parse also.   myDate = df.parse(myString);
===============其它得自己看看资料

解决方案 »

  1.   

    是这样的,我现在有一个字符串
    String str="delete from TB where id="
    因为这个id要不断的变化,所以想问一下有没有格式化的东西
      

  2.   

    java.text.DecimalFormat
    DecimalFormat patterns have the following syntax: 
     Pattern:
             PositivePattern
             PositivePattern ; NegativePattern
     PositivePattern:
             Prefixopt Number Suffixopt
     NegativePattern:
             Prefixopt Number Suffixopt
     Prefix:
             any Unicode characters except \uFFFE, \uFFFF, and special characters
     Suffix:
             any Unicode characters except \uFFFE, \uFFFF, and special characters
     Number:
             Integer Exponentopt
             Integer . Fraction Exponentopt
     Integer:
             MinimumInteger
             #
             # Integer
             # , Integer
     MinimumInteger:
             0
             0 MinimumInteger
             0 , MinimumInteger
     Fraction:
             MinimumFractionopt OptionalFractionopt
     MinimumFraction:
             0 MinimumFractionopt
     OptionalFraction:
             # OptionalFractionopt
     Exponent:
             E MinimumExponent
     MinimumExponent:
             0 MinimumExponentopt
      

  3.   

    我想楼主想要的是这个吧!呵呵
    java.text.MessageFormatUsage Information
    Here are some examples of usage:  Object[] arguments = {
         new Integer(7),
         new Date(System.currentTimeMillis()),
         "a disturbance in the Force"
     }; String result = MessageFormat.format(
         "At {1,time} on {1,date}, there was {2} on planet {0,number,integer}.",
         arguments); output: At 12:30 PM on Jul 3, 2053, there was a disturbance
               in the Force on planet 7. Typically, the message format will come from resources, and the arguments will be dynamically set at runtime. 
    Example 2:  Object[] testArgs = {new Long(3), "MyDisk"}; MessageFormat form = new MessageFormat(
         "The disk \"{1}\" contains {0} file(s)."); System.out.println(form.format(testArgs)); // output, with different testArgs
     output: The disk "MyDisk" contains 0 file(s).
     output: The disk "MyDisk" contains 1 file(s).
     output: The disk "MyDisk" contains 1,273 file(s).
     For more sophisticated patterns, you can use a ChoiceFormat to get output such as:  MessageFormat form = new MessageFormat("The disk \"{1}\" contains {0}.");
     double[] filelimits = {0,1,2};
     String[] filepart = {"no files","one file","{0,number} files"};
     ChoiceFormat fileform = new ChoiceFormat(filelimits, filepart);
     form.setFormatByArgumentIndex(0, fileform); Object[] testArgs = {new Long(12373), "MyDisk"}; System.out.println(form.format(testArgs)); // output, with different testArgs
     output: The disk "MyDisk" contains no files.
     output: The disk "MyDisk" contains one file.
     output: The disk "MyDisk" contains 1,273 files.
      

  4.   

    楼主的问题,Java中叫信息格式化。Struts中处理国际化的资源就类似这样的。可以参考MessageFormat类,例子:Object[] arguments = {
         new Integer(7),
         new Date(System.currentTimeMillis()),
         "a disturbance in the Force"
     }; String result = MessageFormat.format(
         "At {1,time} on {1,date}, there was {2} on planet {0,number,integer}.",
         arguments);输出: At 12:30 PM on Jul 3, 2053, there was a disturbance
               in the Force on planet 7.