Strtolower ($STR)Strtoupper ($STR)Uppercase and lowercase conversionsStrtotime (' 2018-1-1 0:0 ')String Turn timestampDate (' y-m-d h:i:s ', Time ())Formatting timestampsMD5 ()EncryptionTrim ()Removes white space characters (in particular) on either side of the string.Strip_tags ()Filter (delete) HTML tags (specifically reserved)Htmlspecialchars ()Convert special characters (labels) to HTML entities (not labels)Htmlspecialchars_decodeRestoresPHP//uppe
String. format is a new static method in JDK1.5, which has powerful functions. Its main function is to format data, which is roughly divided into these classes (general type, character type, numeric type, date type ). Its syntax is as follows: regular type, character type, and Value Type format specifier Syntax: % [par
s1 = " hello world ";String s2 = s1.trim();
After running, s2 becomes "hello world". This method only removes leading spaces and trailing spaces, but does not remove intermediate spaces.
To remove all spaces, use the StringTokenizer () and replaceAll () methods. For more information about the usage method, see Java API. The syntax format of the two methods
The java interface returns the json data format. The java interface returns the json data format.
The following code:
@ RequestMapping (value = "getCode1.html ")@ ResponseBodyPublic JSONObject getJSON (){List Map JSONObject json = new JSONObject ();Map. put ("message", "111 ");Map. put ("message2"," 222 ");Map. put ("m
string constant pool: string constant pool in method areaTo optimize space, the string class maintains a string pool to reduce the number of strings created in the JVM , and the JVM checks the string constant pool first whenever the code creates a
1. Formatted currency (related to system environment, Chinese system default format RMB, English system format USD)String. Format ("{0:c}", 0.2) results are: ¥0.20 (English operating system results: $0.20)The default formatting retains two decimal places after the decimal point, and if you need to keep one or more, you
Import java. util. date;
Import java. util. locale;
Public class example {
Public static void main (string [] ARGs)
{
Date today = new date ();
String A = string. Format (locale. Us, "% TB", today); // The formatted
How the data of string in Java is stored, the source code can be seen that the string data is stored in a member variable such as char[] value , the size of the char type is 2 bytes in JavaWe also know that the Unicode version that is commonly used now is UCS-2, which is to use 2 bytes to represent the Unicode version of a character, which is right,
Replace each format item in the specified string with the text equivalent item of the value of the corresponding object.
String Str1 = string. Format ("{0: N1}", 56789 ); // Result: 56,789.0 String Str2 =
Java implementation Zip decompression and compression is basically using the Java peptide and recursive technology, can be a single file and any Cascade folder compression and decompression, for some beginners is a good example.Zip plays archive and compresses two roles; gzip does not archive files, only compresses individual files, so on UNIX platforms, command tar is typically used to create an archive fi
();System.out.println ("Start reading Compressed Files ..."); Use Gzipinputstream to wrap the InputStream stream so that it has decompression properties BufferedReader in2 = new BufferedReader (New InputStreamReader TStream (New FileInputStream ("test.txt.gz")), "GBK")); String s; Reads the contents of the compressed file while ((s = in2.readline ()) = null) {SYSTEM.OUT.PRINTLN (s); } in2.close (); }}
Related articles recommended:
In jdk1.5, the string class adds a very useful static function Format (string format, objece... argues), which can format various types of data into strings and output them. The format parameter specifies the output
String. format description C # format the value result table
Character
Description
Example
Output
C
Currency
String. Format ("{0: C3}", 2)
$2.000
D
Decimal
1. Use {0 :?} Format
You can use the string. Format method or the console. Write method to format numeric results. The latter method calls string. format. Use a format
Java converts Json Date/Date (1487053489965 + 0800)/format and js time format Tue Feb 14 2017 14:06:32 GMT + 0800, json1487053489965
/Date (1487053489965 + 0800)/how to convert it to yyyy-MM-dd format in Java
How to convert Tue Feb 14 2017 14:06:32 GMT + 0800 to yyyy-MM-dd
string. Five types of overloads for format:
String. Format (String,object) replaces one or more formatting items in the specified string with the string representation of the specified
Alas, finally set up-the project when the coding method for GBK, but with the continuous development of the final decision will be the code of the project to UTF-8, so that all the Java files containing Chinese have appeared garbled, hundreds of files ah, a change that still not exhausted, moved the brain, Write a piece of Java code, instant fix, the code is as follows:package Com.ghj.packageofclient;import
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.