small change
[cdsspec-compiler.git] / src / edu / uci / eecs / specCompiler / specExtraction / ParserUtils.java
1 package edu.uci.eecs.specCompiler.specExtraction;
2
3 import java.util.ArrayList;
4
5 import edu.uci.eecs.specCompiler.codeGenerator.InterfaceWrongFormatException;
6
7 public class ParserUtils {
8         public static String trimSpace(String line) {
9                 int i, j;
10                 char ch;
11                 for (i = 0; i < line.length(); i++) {
12                         ch = line.charAt(i);
13                         if (ch != ' ' && ch != '\t')
14                                 break;
15                 }
16                 for (j = line.length() - 1; j >= 0; j--) {
17                         ch = line.charAt(j);
18                         if (ch != ' ' && ch != '\t')
19                                 break;
20                 }
21                 if (i > j)
22                         return "";
23                 else
24                         return line.substring(i, j + 1);
25         }
26 }