( constructors must be new )
* public string (char[] Vaue) converts a character array into a string (constructor)
* public string (char[] Vaue,int offset,int count) changes the range of character arrays into strings (constructors)
* public string (byte[],bytes) converts a byte array into a string (constructor)
* public string (byte[],bytes,int offset,int length) converts a byte array into a string (constructor) in the developed range
* Public char[] ToCharArray () converts a string into a character array
* Public char charAt (int index) Remove the top-top position character from a string
* Public byte[] (getBytes) converts a string into a byte array
* public int length () gets the string length
* Public int indexOf (string str) from the beginning to find the specified string position cannot find return-1
* Public int indexOf (string str,int fromIndex) finds the specified string position from the specified location
* Public String trim () clears both left and right spaces
* public string substring (int beginindex) starts from the specified position and fetches the string from the tail
* public string substring (int begin,int end) Specifies the start point and end point of the intercept string
* Public string[] Split (string regex) splits a string according to the specified string
* public string toUpperCase () turns a string all uppercase
* public string toLowerCase () turns a string all lowercase
* Public boolean StartsWith (string prefix) to infer whether to start with a string
* Public boolean EndsWith (string suffix) to infer whether to end with a string
* Public boolean equals (String str) infers whether two strings are equal
* Public boolean equalsignorcase (string str) does not differentiate between uppercase and lowercase strings for equality
* Public string ReplaceAll (string regex,string replacement) string substitution
Example:
public class Strdemos {public static void main (String args[]) { char[] s={' g ', ' 1 ', ' C ', ' C '}; String Str=null; Str=new String (s); System.out.println (str);//Converts a character array into a string char[]d=str.tochararray ();//Converts a string to a character array for (int i=0;i< d.length;i++) { System.out.println (d[i]);}} Output: g1ccg1cc
21 ways to use String in Java