String. format

Source: Internet
Author: User

Public class StringFormat {
Public static void main (String [] args ){
Method ("aa", 124 );
    }
    
Public static void method (String a, int B ){

// Result:/inner/payment/aa/courier/124
String s = String. format ("/inner/payment/% s/courier/% d", a, B );
System. out. println (s );
    }
}

Date date = new Date (); // 2014-11-07

// Output the date represented by two digits, which is less than 07

System. out. println (String. format ("% td", date ));

// Output the date represented by two digits. Do not fill in 7

System. out. println (String. format ("% te", date ));

// Returns the month in double digits. If the digit is not enough, auto-fill is set to 11.

System. out. println (String. format ("% tm", date ));

// Output year 14 with two digits

System. out. println (String. format ("% ty", date ));

// Output the year 2014 of the four digits

System. out. println (String. format ("% tY", date ));

// Output the day of the year (001-366) 311

System. out. println (String. format ("% tj", date ));

// Output the week (Friday) of the specified language environment

System. out. println (String. format ("% ta", date ));

// Output the full name of the week for the specified language environment, Friday

System. out. println (String. format ("% tA", date ));

// Output the month of the specified language environment (January 1, November)

System. out. println (String. format ("% tb", date ));

// Output the full name of the month in the specified language environment, January 1, November

System. out. println (String. format ("% tB", date ));

// Output all date and time information of the specified language environment on the day of the week, September 07 14:17:51 CST 2014

System. out. println (String. format ("% tc", date ));

String. format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.