Java Utililty Methods String Chop

List of utility methods to do String Chop

  1. HOME
  2. Java
  3. S
  4. String Chop

Description

The list of methods to do String Chop are organized into topic(s).

Method

double[][] chop(double[][] a, double precision)
Sets all elements of matrix which is less than precision to zero
int n = a.length;
for (int i = 0; i < n; i++) {
 for (int j = 0; j < n; j++) {
 if (Math.abs(a[i][j]) < precision) {
 a[i][j] = 0;
return a;
String chop(final String source)
chop
return chop(source, "/"); 
String chop(String aString)
Chops off the very last character of the given string.
if (aString == null) {
 return null;
if (aString.length() == 0) {
 return "";
if (aString.length() == 1) {
 return "";
...
String chop(String line)
chop
if (line.endsWith("\r\n")) {
 return line.substring(0, line.length() - 2);
if (line.endsWith("\n")) {
 return line.substring(0, line.length() - 1);
if (line.endsWith("\r")) {
 return line.substring(0, line.length() - 1);
...
String chop(String s)
chop
if (s == null) {
 return (null);
if (s.length() == 1) {
 return (new String());
s = s.substring(0, (s.length() - 1));
return (s);
...
String chop(String s, int i)
Chop i characters off the end of a string.
return chop(s, i, EOL);
String chop(String s, int maxLength)
Return the original string if it is shorter than maxLength, otherwise return a substring with length maxLength.
if (s == null)
 return null;
if (maxLength <= s.length())
 return s;
return s.substring(0, maxLength - 1) + " ...";
String chop(String src, String delim)
return prefix string by delim(remove delim string and its following charactors).
int index = -1;
if (0 <= (index = src.lastIndexOf(delim))) {
 return src.substring(0, index);
} else {
 return src;
String chop(String str)
chop
if (str == null) {
 return null;
int strLen = str.length();
if (strLen < 2) {
 return "";
int lastIdx = strLen - 1;
...
String chop(String str)

Remove the last character from a String.

if ("".equals(str)) {
 return "";
if (str.length() == 1) {
 return "";
int lastIdx = str.length() - 1;
String ret = str.substring(0, lastIdx);
...


AltStyle によって変換されたページ (->オリジナル) /