Tag: esconing

在插入derbyDB varchar字段之前,搜索“特殊”字符的java字符串

我试图从MS Access转换为DerbyDB。 但是,某些varchar字段具有“特殊”字符,例如换行符,制表符,百分号,外来字符等。 我创建了一个快速方法…… public String charCheck(String s) { errLog.add(1, “converting string from ” + s); s.replaceAll(“‘”, “””);//an apostrophe is escaped with an apostrophy in Derby… s.replaceAll(“%”, “\\%”);//a percent sign s.replaceAll(“\\s+n”, ” “);//whitespace characters (newlines and tabs etc) s.replaceAll(“/”, “\\/”);//the ‘divide’ \ character, s.replaceAll(“<", "\\”, “\\>”);//mathematical symbol greater than errLog.add(1, “to ” + s); return […]