@Test public void findTokenEnd() throws Exception { assertThat(tokenizer.findTokenEnd("", 0), is(0)); assertThat(tokenizer.findTokenEnd("@", 0), is(1)); assertThat(tokenizer.findTokenEnd("@ ", 0), is(0)); assertThat(tokenizer.findTokenEnd("@te ", 0), is(2)); assertThat(tokenizer.findTokenEnd("@te @tests", 0), is(2)); assertThat(tokenizer.findTokenEnd("@te @tests ", 4), is(9)); assertThat(tokenizer.findTokenEnd("@te@tests ", 0), is(8)); assertThat(tokenizer.findTokenEnd("\n@tetests\n", 1), is(8)); assertThat(tokenizer.findTokenEnd(" ", 0), is(0)); assertThat(tokenizer.findTokenEnd("@ ", 2), is(2)); assertThat(tokenizer.findTokenEnd("tests:", 0), is(6)); assertThat(tokenizer.findTokenEnd("test@s:", 0), is(7)); assertThat(tokenizer.findTokenEnd("test@\ns:", 0), is(4)); }
@Override public int findTokenEnd(CharSequence text, int cursor) { int length = text.length(); if (length == 0) { return 0; } char separator = getDefaultSeparator(); for (int i = cursor; i < length; i++) { char charAt = text.charAt(i); if (charAt == separator || charAt == NEW_LINE) { return i == 0 ? 0 : i - 1; } } return length; }
PrefixTokenizer implements MultiAutoCompleteTextView.Tokenizer { @Override public int findTokenEnd(CharSequence text, int cursor) { int length = text.length(); if (length == 0) { return 0; } char separator = getDefaultSeparator(); for (int i = cursor; i < length; i++) { char charAt = text.charAt(i); if (charAt == separator || charAt == NEW_LINE) { return i == 0 ? 0 : i - 1; } } return length; } }
PrefixTokenizer implements MultiAutoCompleteTextView.Tokenizer { @Override public int findTokenEnd(CharSequence text, int cursor) { int length = text.length(); if (length == 0) { return 0; } char separator = getDefaultSeparator(); for (int i = cursor; i < length; i++) { char charAt = text.charAt(i); if (charAt == separator || charAt == NEW_LINE) { return i == 0 ? 0 : i - 1; } } return length; } PrefixTokenizer(char prefix);  PrefixTokenizer(char... prefixes); }
PrefixTokenizer implements MultiAutoCompleteTextView.Tokenizer { @Override public int findTokenEnd(CharSequence text, int cursor) { int length = text.length(); if (length == 0) { return 0; } char separator = getDefaultSeparator(); for (int i = cursor; i < length; i++) { char charAt = text.charAt(i); if (charAt == separator || charAt == NEW_LINE) { return i == 0 ? 0 : i - 1; } } return length; } PrefixTokenizer(char prefix);  PrefixTokenizer(char... prefixes); @Override int findTokenStart(CharSequence text, int cursor); @Override int findTokenEnd(CharSequence text, int cursor); @Override CharSequence terminateToken(CharSequence text); }
PrefixTokenizer implements MultiAutoCompleteTextView.Tokenizer { @Override public int findTokenEnd(CharSequence text, int cursor) { int length = text.length(); if (length == 0) { return 0; } char separator = getDefaultSeparator(); for (int i = cursor; i < length; i++) { char charAt = text.charAt(i); if (charAt == separator || charAt == NEW_LINE) { return i == 0 ? 0 : i - 1; } } return length; } PrefixTokenizer(char prefix);  PrefixTokenizer(char... prefixes); @Override int findTokenStart(CharSequence text, int cursor); @Override int findTokenEnd(CharSequence text, int cursor); @Override CharSequence terminateToken(CharSequence text);  }