Back to project page ScalAR.
The source code is released under:
GNU General Public License
If you think the Android project ScalAR listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package edu.dhbw.andobjviewer.parser; /*from ww w.jav a2s .com*/ public class SimpleTokenizer { String str = ""; String delimiter = " "; int delimiterLength = delimiter.length(); int i =0; int j =0; public final String getStr() { return str; } public final void setStr(String str) { this.str = str; i =0; j =str.indexOf(delimiter); } public final String getDelimiter() { return delimiter; } public final void setDelimiter(String delimiter) { this.delimiter = delimiter; delimiterLength = delimiter.length(); } public final boolean hasNext() { return j >= 0; } public final String next() { if(j >= 0) { String result = str.substring(i,j); i = j + 1; j = str.indexOf(delimiter, i); return result; } else { return str.substring(i); } } public final String last() { return str.substring(i); } /** * how often does the delimiter occur in the given string? * @return */ public final int delimOccurCount() { int result = 0; if (delimiterLength > 0) { int start = str.indexOf(delimiter); while (start != -1) { result++; start = str.indexOf(delimiter, start + delimiterLength); } } return result; } }