Skip to content

Instantly share code, notes, and snippets.

@ron623
Created March 23, 2015 08:54
Show Gist options
  • Save ron623/9e433f398f981d2c12f1 to your computer and use it in GitHub Desktop.
Save ron623/9e433f398f981d2c12f1 to your computer and use it in GitHub Desktop.
substring
/**
*この文字列の部分文字列である新しい文字列を返します。部分文字列は、指定された beginIndex から始まり、
*インデックス endIndex - 1 にある文字までです。したがって、部分文字列の長さは endIndex-beginIndex になります。
*/
public String substring(int beginIndex, int endIndex) {
return ((beginIndex == 0) && (endIndex == count)) ? this :
new String(offset + beginIndex, endIndex - beginIndex, value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment