本文整理汇总了Java中org.h2.util.StringUtils.toLowerEnglish方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.toLowerEnglish方法的具体用法?Java StringUtils.toLowerEnglish怎么用?Java StringUtils.toLowerEnglish使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.h2.util.StringUtils
的用法示例。
在下文中一共展示了StringUtils.toLowerEnglish方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readPages
import org.h2.util.StringUtils; //导入方法依赖的package包/类
private void readPages(String dir, File file, int level) throws Exception {
String name = file.getName();
String fileName = dir.length() > 0 ? dir + "/" + name : level > 0 ? name : "";
if (file.isDirectory()) {
for (File f : file.listFiles()) {
readPages(fileName, f, level + 1);
}
return;
}
String lower = StringUtils.toLowerEnglish(name);
if (!lower.endsWith(".html") && !lower.endsWith(".htm")) {
return;
}
if (lower.contains("_ja.")) {
return;
}
if (!noIndex.contains(fileName)) {
page = new Page(pages.size(), fileName);
pages.add(page);
readPage(file);
}
}
示例2: addRule
import org.h2.util.StringUtils; //导入方法依赖的package包/类
private RuleHead addRule(String topic, String section, Rule rule) {
RuleHead head = new RuleHead(section, topic, rule);
String key = StringUtils.toLowerEnglish(topic.trim().replace(' ', '_'));
if (ruleMap.get(key) != null) {
throw new AssertionError("already exists: " + topic);
}
ruleMap.put(key, head);
return head;
}
示例3: updateTopic
import org.h2.util.StringUtils; //导入方法依赖的package包/类
/**
* Update a topic with a context specific rule.
* This is used for autocomplete support.
*
* @param topic the topic
* @param rule the database context rule
*/
public void updateTopic(String topic, DbContextRule rule) {
topic = StringUtils.toLowerEnglish(topic);
RuleHead head = ruleMap.get(topic);
if (head == null) {
head = new RuleHead("db", topic, rule);
ruleMap.put(topic, head);
statements.add(head);
} else {
head.setRule(rule);
}
}
示例4: RuleElement
import org.h2.util.StringUtils; //导入方法依赖的package包/类
public RuleElement(String name, String topic) {
this.name = name;
this.keyword = name.length() == 1 ||
name.equals(StringUtils.toUpperEnglish(name));
topic = StringUtils.toLowerEnglish(topic);
this.type = topic.startsWith("function") ?
Sentence.FUNCTION : Sentence.KEYWORD;
}
示例5: getSQL
import org.h2.util.StringUtils; //导入方法依赖的package包/类
private String getSQL(String s) {
String lower = StringUtils.toLowerEnglish(s);
if (lower.startsWith("show max_identifier_length")) {
s = "CALL 63";
} else if (lower.startsWith("set client_encoding to")) {
s = "set DATESTYLE ISO";
}
// s = StringUtils.replaceAll(s, "i.indkey[ia.attnum-1]", "0");
if (server.getTrace()) {
server.trace(s + ";");
}
return s;
}
示例6: getLink
import org.h2.util.StringUtils; //导入方法依赖的package包/类
/**
* Get the HTML link to the given token.
*
* @param bnf the BNF
* @param token the token
* @return the HTML link
*/
String getLink(Bnf bnf, String token) {
RuleHead found = null;
String key = Bnf.getRuleMapKey(token);
for (int i = 0; i < token.length(); i++) {
String test = StringUtils.toLowerEnglish(key.substring(i));
RuleHead r = bnf.getRuleHead(test);
if (r != null) {
found = r;
break;
}
}
if (found == null) {
return token;
}
String page = "grammar.html";
if (found.getSection().startsWith("Data Types")) {
page = "datatypes.html";
} else if (found.getSection().startsWith("Functions")) {
page = "functions.html";
} else if (token.equals("@[email protected]")) {
return "<a href=\"functions.html\">Function</a>";
} else if (found.getRule() instanceof RuleFixed) {
found.getRule().accept(this);
return html;
}
String link = found.getTopic().toLowerCase().replace(' ', '_');
link = page + "#" + StringUtils.urlEncode(link);
return "<a href=\"" + link + "\">" + token + "</a>";
}
示例7: Database
import org.h2.util.StringUtils; //导入方法依赖的package包/类
public Database(ConnectionInfo ci, String cipher) {
String name = ci.getName();
this.dbSettings = ci.getDbSettings();
this.reconnectCheckDelay = dbSettings.reconnectCheckDelay;
this.compareMode = CompareMode.getInstance(null, 0);
this.persistent = ci.isPersistent();
this.filePasswordHash = ci.getFilePasswordHash();
this.fileEncryptionKey = ci.getFileEncryptionKey();
this.databaseName = name;
this.databaseShortName = parseDatabaseShortName();
this.maxLengthInplaceLob = Constants.DEFAULT_MAX_LENGTH_INPLACE_LOB;
this.cipher = cipher;
String lockMethodName = ci.getProperty("FILE_LOCK", null);
this.accessModeData = StringUtils.toLowerEnglish(
ci.getProperty("ACCESS_MODE_DATA", "rw"));
this.autoServerMode = ci.getProperty("AUTO_SERVER", false);
this.autoServerPort = ci.getProperty("AUTO_SERVER_PORT", 0);
int defaultCacheSize = Utils.scaleForAvailableMemory(
Constants.CACHE_SIZE_DEFAULT);
this.cacheSize =
ci.getProperty("CACHE_SIZE", defaultCacheSize);
this.pageSize = ci.getProperty("PAGE_SIZE",
Constants.DEFAULT_PAGE_SIZE);
if ("r".equals(accessModeData)) {
readOnly = true;
}
if (dbSettings.mvStore && lockMethodName == null) {
if (autoServerMode) {
fileLockMethod = FileLock.LOCK_FILE;
} else {
fileLockMethod = FileLock.LOCK_FS;
}
} else {
fileLockMethod = FileLock.getFileLockMethod(lockMethodName);
}
if (dbSettings.mvStore && fileLockMethod == FileLock.LOCK_SERIALIZED) {
throw DbException.getUnsupportedException(
"MV_STORE combined with FILE_LOCK=SERIALIZED");
}
this.databaseURL = ci.getURL();
String listener = ci.removeProperty("DATABASE_EVENT_LISTENER", null);
if (listener != null) {
listener = StringUtils.trim(listener, true, true, "'");
setEventListenerClass(listener);
}
String modeName = ci.removeProperty("MODE", null);
if (modeName != null) {
this.mode = Mode.getInstance(modeName);
}
this.multiVersion =
ci.getProperty("MVCC", dbSettings.mvStore);
this.logMode =
ci.getProperty("LOG", PageStore.LOG_MODE_SYNC);
this.javaObjectSerializerName =
ci.getProperty("JAVA_OBJECT_SERIALIZER", null);
this.multiThreaded =
ci.getProperty("MULTI_THREADED", false);
boolean closeAtVmShutdown =
dbSettings.dbCloseOnExit;
int traceLevelFile =
ci.getIntProperty(SetTypes.TRACE_LEVEL_FILE,
TraceSystem.DEFAULT_TRACE_LEVEL_FILE);
int traceLevelSystemOut =
ci.getIntProperty(SetTypes.TRACE_LEVEL_SYSTEM_OUT,
TraceSystem.DEFAULT_TRACE_LEVEL_SYSTEM_OUT);
this.cacheType = StringUtils.toUpperEnglish(
ci.removeProperty("CACHE_TYPE", Constants.CACHE_TYPE_DEFAULT));
openDatabase(traceLevelFile, traceLevelSystemOut, closeAtVmShutdown);
}
示例8: parseHeader
import org.h2.util.StringUtils; //导入方法依赖的package包/类
private boolean parseHeader() throws IOException {
boolean keepAlive = false;
trace("parseHeader");
int len = 0;
ifModifiedSince = null;
boolean multipart = false;
while (true) {
String line = readHeaderLine();
if (line == null) {
break;
}
trace(" " + line);
String lower = StringUtils.toLowerEnglish(line);
if (lower.startsWith("if-modified-since")) {
ifModifiedSince = getHeaderLineValue(line);
} else if (lower.startsWith("connection")) {
String conn = getHeaderLineValue(line);
if ("keep-alive".equals(conn)) {
keepAlive = true;
}
} else if (lower.startsWith("content-type")) {
String type = getHeaderLineValue(line);
if (type.startsWith("multipart/form-data")) {
multipart = true;
}
} else if (lower.startsWith("content-length")) {
len = Integer.parseInt(getHeaderLineValue(line));
trace("len=" + len);
} else if (lower.startsWith("user-agent")) {
boolean isWebKit = lower.contains("webkit/");
if (isWebKit && session != null) {
// workaround for what seems to be a WebKit bug:
// http://code.google.com/p/chromium/issues/detail?id=6402
session.put("frame-border", "1");
session.put("frameset-border", "2");
}
} else if (lower.startsWith("accept-language")) {
Locale locale = session == null ? null : session.locale;
if (locale == null) {
String languages = getHeaderLineValue(line);
StringTokenizer tokenizer = new StringTokenizer(languages, ",;");
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
if (!token.startsWith("q=")) {
if (server.supportsLanguage(token)) {
int dash = token.indexOf('-');
if (dash >= 0) {
String language = token.substring(0, dash);
String country = token.substring(dash + 1);
locale = new Locale(language, country);
} else {
locale = new Locale(token, "");
}
headerLanguage = locale.getLanguage();
if (session != null) {
session.locale = locale;
session.put("language", headerLanguage);
server.readTranslations(session, headerLanguage);
}
break;
}
}
}
}
} else if (line.trim().length() == 0) {
break;
}
}
if (multipart) {
uploadMultipart(input, len);
} else if (session != null && len > 0) {
byte[] bytes = DataUtils.newBytes(len);
for (int pos = 0; pos < len;) {
pos += input.read(bytes, pos, len - pos);
}
String s = new String(bytes);
parseAttributes(s);
}
return keepAlive;
}
示例9: identifier
import org.h2.util.StringUtils; //导入方法依赖的package包/类
private String identifier(String s) {
if (database.getMode().lowerCaseIdentifiers) {
s = s == null ? null : StringUtils.toLowerEnglish(s);
}
return s;
}
示例10: listWords
import org.h2.util.StringUtils; //导入方法依赖的package包/类
private void listWords() {
output.println("// words: " + wordList.size());
StringBuilder buff = new StringBuilder();
String first = "";
int firstLen = 1;
int totalRelations = 0;
for (Word word : wordList) {
ArrayList<Weight> weights = word.getSortedWeights();
String lower = StringUtils.toLowerEnglish(word.name);
if (!first.equals(lower.substring(0, firstLen))) {
if (buff.length() > 0) {
output.println("ref['" + convertUTF(first) + "']='" + buff.toString() + "';");
buff = new StringBuilder();
}
first = lower.substring(0, firstLen);
}
if (buff.length() > 0) {
buff.append(';');
}
buff.append(convertUTF(word.name));
buff.append('=');
String weightString = "r";
totalRelations += weights.size();
for (int j = 0; j < weights.size(); j++) {
Weight weight = weights.get(j);
Page p = weight.page;
if (j > 0) {
buff.append(",");
}
String ws;
if (weight.value >= Weight.TITLE) {
ws = "t";
} else if (weight.value >= Weight.HEADER) {
ws = "h";
} else {
ws = "r";
}
if (!ws.equals(weightString)) {
weightString = ws;
buff.append(ws);
}
buff.append(p.id);
}
}
output.println("ref['" + convertUTF(first) + "']='" + buff.toString() + "';");
output.println("// totalRelations: " + totalRelations);
output.println("ignored='" + ignored.toLowerCase() + "';");
}
示例11: process
import org.h2.util.StringUtils; //导入方法依赖的package包/类
private void process(String text) {
text = HtmlConverter.convertHtmlToString(text);
if (title) {
if (page.title == null) {
page.title = text;
} else {
page.title = page.title + " " + text;
}
}
int weight;
if (title) {
weight = Weight.TITLE;
} else if (heading) {
weight = Weight.HEADER;
} else {
weight = Weight.PARAGRAPH;
}
// this list of constants needs to be the same in search.js
// (char) 160: nbsp
StringTokenizer t = new StringTokenizer(text,
" \t\r\n\"'.,:;!&/\\?%@`[]{}()+-=<>|*^~#$" + (char) 160, false);
while (t.hasMoreTokens()) {
String token = t.nextToken();
if (token.length() < MIN_WORD_SIZE) {
continue;
}
if (Character.isDigit(token.charAt(0))) {
continue;
}
String lower = StringUtils.toLowerEnglish(token);
Word word = words.get(lower);
if (word == null) {
word = new Word(token);
words.put(lower, word);
} else if (!word.name.equals(token)) {
word.name = token.compareTo(word.name) > 0 ? token : word.name;
}
page.totalWeight += weight;
word.addPage(page, weight);
}
}