Java Common API

Source: Internet
Author: User

String processing: String str = ".....";..

*str.equals (); Compares whether the values of two strings are equal to the underlying data type, and compares two variables to the same address.

equals compares the values of two objects for equality.

*str.length ();//Gets the length of the entire string

Str.trim ();//remove spaces on both sides of the string

Str.charat (int i);//Gets the character on an index value

Str.contains (charsequence s);//Whether to include a string

Str.startswith (String s); Determine whether to start with a string

Str.endswith (String s); Determine whether to end with a string

Replace (char O, char N); Replace all o in the string with n

Replace (charsequence O, charsequence n);//Ibid.

*split (String s); Split string

toUpperCase (); Convert a string to uppercase

toLowerCase (); Convert to lowercase

ValueOf (any args); Gets a string instance of an arbitrary argument

*str.indexof (string s);//The index position at which this string appears for the first time

Str.lastindexof (string s);//Take the index where this string last appears

str.substring (int i);//The index value is the string following the integer argument

str.substring (int A, int b);//Take a string between A and B (not including B)

StringBuffer (with buffers) are used primarily to build strings

*stringbuffer append (char c)//Append

StringBuffer Insert (int offset, string str)//Inserts a string at an index location

StringBuffer deletecharat (int index)

StringBuffer Delete (int start, int end)

StringBuffer replace (int start, int end, String s)

StringBuffer setcharat (int index, char ch)

String toString ()

StringBuffer reverse ()//Invert string

System class

static void exit (int status) exits the currently running Java Virtual machine, 0 indicates normal exit

Static long GC ()//manual start garbage collection mechanism is not recommended to manually call System.GC ();

Objects that are outside the scope of the variable will be retrieved automatically by the garbage collection mechanism to call the Finalize method

Long static Currenttimemillis ()//returns the current system time (in the form of a timestamp)

static void Arraycopy (object src, int srcpos, object dest, int destpos, int length)

Digital Packaging class:

Automatic Packing/Unpacking

*integer.parseint (String s); Convert String to int

Integer.parseint (String s, int radix); Convert other binary strings to int

integer.tobinarystring (int i); Converts an int value into a binary string

integer.tooctalstring (int i); Converts an int to an octal string

integer.tohexstring (int i); Converts an int to a 16-binary string

Java Common API

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.