java String 易错点记录

  1. public String substring(int beginIndex, int endIndex)

Examples:

 "hamburger".substring(4, 8) returns "urge"
 "smiles".substring(1, 5) returns "mile"

Parameters:

  beginIndex - the beginning index, inclusive.

  endIndex - the ending index, exclusive.

public String substring(int beginIndex)
Returns a new string that is a substring of this string. The substring begins with the character at the specified index and extends to the end of this string.

Examples:

 "unhappy".substring(2) returns "happy"
 "Harbison".substring(3) returns "bison"
 "emptiness".substring(9) returns "" (an empty string)
 
Parameters:
beginIndex - the beginning index, inclusive.
Returns:
the specified substring.

 

 

 

 

 

 

 

posted @ 2013-01-15 19:10  feiling  阅读(218)  评论(0编辑  收藏  举报