string

public final class String extends Object implements Serializable, Comparable<String>, CharSequence String 類型繼承 Serializable, Comparable<String>, CharSequence 接口。 The String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class. string類表明字符串,在java程序中,全部的string 字面值,好比abc ,都是實現這個類的實例。java

Strings are constant; their values cannot be changed after they are created. String buffers support mutable strings. Because String objects are immutable they can be shared. For example: string 類型是常量,他們被建立後不會背改變,字符串緩衝區支持可變的字符串,由於他們可共享字符串的 對象是不可變的 ,以下面兩個是相等的 。 String str = "abc";app

is equivalent to:less

char data[] = {'a', 'b', 'c'};
 String str = new String(data);

Here are some more examples of how strings can be used: 下面有更多的列子 System.out.println("abc"); String cde = "cde"; System.out.println("abc" + cde); String c = "abc".substring(2,3); String d = cde.substring(1, 2);ide

The class String includes methods for examining individual characters of the sequence, for comparing strings, for searching strings, for extracting substrings, and for creating a copy of a string with all characters translated to uppercase or to lowercase. Case mapping is based on the Unicode Standard version specified by the Character class.函數

string 類方法包含對單個字符序列的審查,如比較字符串,查找字符串、提取子串和建立字符串的副本將其轉換成大寫或者小寫,映射狀況下基於unicode字符串的標準版。ui

The Java language provides special support for the string concatenation operator ( + ), and for conversion of other objects to strings. String concatenation is implemented through the StringBuilder(or StringBuffer) class and its append method. String conversions are implemented through the method toString, defined by Object and inherited by all classes in Java. For additional information on string concatenation and conversion, see Gosling, Joy, and Steele, The Java Language Specification.this

java語言包含專門支持字符串的符號和轉換成字符串的方法,字符串的執行經過他的stringbuilder類和它的附加方法。string 包含tostring方法,定義object和繼承全部的java類,字符串轉換和鏈接的全部信息參考gosling,joy 和steele中的java語言規範編碼

Unless otherwise noted, passing a null argument to a constructor or method in this class will cause a NullPointerException to be thrown.指針

除非在特殊的狀況下,經過null值訪問一個類的構造函數或者方法將會被拋出一個空指針異常。code

A String represents a string in the UTF-16 format in which supplementary characters are represented by surrogate pairs (see the section Unicode Character Representations in the Character class for more information). Index values refer to char code units, so a supplementary character uses two positions in a String. 一個字符串表明一個字符串補充格式utf16的字符串,索引值是指編碼單元,因此補充字符串在字符串中佔用了2個位置。 The String class provides methods for dealing with Unicode code points (i.e., characters), in addition to those for dealing with Unicode code units (i.e., char values).

Since: JDK1.0 See Also: Object.toString(), StringBuffer, StringBuilder, Charset, Serialized Form

相關文章
相關標籤/搜索