1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 17:55:39 +02:00

trim strings

This commit is contained in:
Alain Magloire 2003-09-08 04:57:59 +00:00
parent a8edb98ca7
commit 02988e794e

View file

@ -22,7 +22,7 @@ public class MacroDefinition extends Statement implements IMacroDefinition {
value = new StringBuffer(); value = new StringBuffer();
int index = line.indexOf('='); int index = line.indexOf('=');
if (index != -1) { if (index != -1) {
name = line.substring(0, index); name = line.substring(0, index).trim();
value.append(line.substring(index + 1)); value.append(line.substring(index + 1));
} else { } else {
name = line; name = line;
@ -39,11 +39,11 @@ public class MacroDefinition extends Statement implements IMacroDefinition {
} }
public void setName(String n) { public void setName(String n) {
name = n; name = (n == null) ? "" : n.trim() ;
} }
public String getValue() { public String getValue() {
return value.toString(); return value.toString().trim();
} }
public void setValue(String val) { public void setValue(String val) {
@ -59,7 +59,7 @@ public class MacroDefinition extends Statement implements IMacroDefinition {
*/ */
public String toString() { public String toString() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append(name).append(" = ").append(value).append('\n'); buffer.append(getName()).append(" = ").append(getValue()).append('\n');
return buffer.toString(); return buffer.toString();
} }