Logo Search packages:      
Sourcecode: jmk version File versions  Download package

static String [] edu::neu::ccs::jmk::awt::MakeWindow::string2String_array ( String  str  )  [inline, static, private]

Break a string into an array of strings. A space character marks a breaking point.

Definition at line 196 of file MakeWindow.java.

Referenced by actionPerformed().

                                                          {
    Vector v = new Vector();
    int s = 0;                    // s is the start index

    while (s < str.length()) {
      if (str.charAt(s) == ' ')
      s++;
      else {
      int e = str.indexOf(' ', s); // e is the end index
      if (e < 0) {
        v.addElement(str.substring(s));
        break;
      }
      v.addElement(str.substring(s, e));
      s = e + 1;
      }
    }

    String[] str_array = new String[v.size()];
    v.copyInto(str_array);
    return str_array;
  }


Generated by  Doxygen 1.6.0   Back to index