Sha256: 3e419dbcad29768575af18b09479ecf77cad469cbd13a48703f941542d054962
Contents?: true
Size: 882 Bytes
Versions: 28
Compression:
Stored size: 882 Bytes
Contents
package com.rho; public class Tokenizer { String m_str; String m_delims; int m_length; int m_position; public Tokenizer(String str,String delims) { m_delims = delims; m_str = str; m_length = str.length(); m_position = 0; } public String nextToken() { //eatDelimeters(); int start = m_position; while (m_position<m_length && m_delims.indexOf(m_str.charAt(m_position))==-1) { m_position++; } String strToken = m_str.substring(start,m_position); eatDelimeters(); return strToken; } public void eatDelimeters() { if ( m_position == m_length ) m_position++; else if (m_position<m_length) { char c = m_str.charAt(m_position); if (m_delims.indexOf(c)>=0) { m_position++; } else { return; } } } public boolean hasMoreTokens() { //eatDelimeters(); return (m_position <= m_length); } }
Version data entries
28 entries across 28 versions & 1 rubygems