Skip to content

Instantly share code, notes, and snippets.

@tgab
Created March 9, 2010 03:25
Show Gist options
  • Save tgab/326115 to your computer and use it in GitHub Desktop.
Save tgab/326115 to your computer and use it in GitHub Desktop.
// This is the code I used in java in order to get rid of leading
// and trailing whitespace that the String.trim() function can't
// handle
// line is a String containing the current line I have just read
// from the .asm file
try {
while (Character.isWhitespace(line.charAt(0))){
line = line.substring(1, line.length());
}
while (Character.isWhitespace(line.charAt(line.length()-1))){
line = line.substring(0, line.length()-1);
}
} catch (IndexOutOfBoundsException e){
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment