mirror of
https://github.com/processing/processing4.git
synced 2026-02-04 22:29:18 +01:00
closing up Table work, moving functions a bit, hide unapproved
This commit is contained in:
@@ -2223,53 +2223,6 @@ public class Table {
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
/**
|
||||
* Remove any of the specified characters from the entire table.
|
||||
*/
|
||||
public void removeTokens(String tokens) {
|
||||
for (int col = 0; col < getColumnCount(); col++) {
|
||||
removeTokens(tokens, col);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removed any of the specified characters from a column. For instance,
|
||||
* the following code removes dollar signs and commas from column 2:
|
||||
* <pre>
|
||||
* table.removeTokens(",$", 2);
|
||||
* </pre>
|
||||
*/
|
||||
public void removeTokens(String tokens, int column) {
|
||||
for (int row = 0; row < rowCount; row++) {
|
||||
String s = getString(row, column);
|
||||
if (s != null) {
|
||||
char[] c = s.toCharArray();
|
||||
int index = 0;
|
||||
for (int j = 0; j < c.length; j++) {
|
||||
if (tokens.indexOf(c[j]) == -1) {
|
||||
if (index != j) {
|
||||
c[index] = c[j];
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if (index != c.length) {
|
||||
setString(row, column, new String(c, 0, index));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void removeTokens(String tokens, String columnName) {
|
||||
removeTokens(tokens, getColumnIndex(columnName));
|
||||
}
|
||||
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
/**
|
||||
* Return the row that contains the first String that matches.
|
||||
* @param value the String to match
|
||||
@@ -2574,6 +2527,53 @@ public class Table {
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
/**
|
||||
* Remove any of the specified characters from the entire table.
|
||||
*/
|
||||
public void removeTokens(String tokens) {
|
||||
for (int col = 0; col < getColumnCount(); col++) {
|
||||
removeTokens(tokens, col);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removed any of the specified characters from a column. For instance,
|
||||
* the following code removes dollar signs and commas from column 2:
|
||||
* <pre>
|
||||
* table.removeTokens(",$", 2);
|
||||
* </pre>
|
||||
*/
|
||||
public void removeTokens(String tokens, int column) {
|
||||
for (int row = 0; row < rowCount; row++) {
|
||||
String s = getString(row, column);
|
||||
if (s != null) {
|
||||
char[] c = s.toCharArray();
|
||||
int index = 0;
|
||||
for (int j = 0; j < c.length; j++) {
|
||||
if (tokens.indexOf(c[j]) == -1) {
|
||||
if (index != j) {
|
||||
c[index] = c[j];
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if (index != c.length) {
|
||||
setString(row, column, new String(c, 0, index));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void removeTokens(String tokens, String columnName) {
|
||||
removeTokens(tokens, getColumnIndex(columnName));
|
||||
}
|
||||
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
public void trim() {
|
||||
for (int col = 0; col < getColumnCount(); col++) {
|
||||
trim(col);
|
||||
|
||||
Reference in New Issue
Block a user