use of org.omegat.tokenizer.ITokenizer in project omegat by omegat-org.
the class EditorUtils method doChangeCase.
/**
* Change the case of the input string to the indicated case. When toWhat is
* {@link CHANGE_CASE_TO#CYCLE} the result will be UPPER > LOWER > SENTENCE
* > TITLE > UPPER.
* <p>
* This is a convenience method for
* {@link #doChangeCase(String, CHANGE_CASE_TO, Locale, ITokenizer)}. The
* locale and tokenizer will be taken from the current project's target
* language values.
*
* @param input
* The string to change
* @param toWhat
* The case to change to, or {@link CHANGE_CASE_TO#CYCLE}
* @return The modified string
*/
public static String doChangeCase(String input, CHANGE_CASE_TO toWhat) {
Locale locale = Core.getProject().getProjectProperties().getTargetLanguage().getLocale();
ITokenizer tokenizer = Core.getProject().getTargetTokenizer();
return doChangeCase(input, toWhat, locale, tokenizer);
}
use of org.omegat.tokenizer.ITokenizer in project omegat by omegat-org.
the class AutoCompleterListView method getLastToken.
protected String getLastToken(String text) {
String token = "";
ITokenizer tokenizer = getTokenizer();
Token[] tokens = tokenizer.tokenizeVerbatim(text);
if (tokens.length != 0) {
Token lastToken = tokens[tokens.length - 1];
String lastString = text.substring(lastToken.getOffset()).trim();
if (!lastString.isEmpty()) {
token = lastString;
}
}
return token;
}
Aggregations