hi all, I have some problems to use Jexl expressions to look for special characters in strings, like newline or tabs:
e = ExpressionFactory.createExpression("foo.bar.indexOf('\n')"); o = e.evaluate(jc); there seem to be no way to encode the linebreak, I also tried '\\n' etc. No chance, always get an exception. Is this a bug in Jexl or is it my fault? Has anybody done this? How? I would appreciate any help... kind regards, Christoph P.S.: Here is my test programm: import org.apache.commons.jexl.Expression; import org.apache.commons.jexl.ExpressionFactory; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.JexlHelper; public class TestJexlLinebreaks { public static class Foo { String bar = "This is line 1,\nline 2,\nline 3."; public String getBar() { return this.bar; } } public static void main(String[] args) throws Exception { // First make a jexlContext and put stuff in it... JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo()); jc.getVars().put("number", new Integer(10)); // access a property... Expression e = ExpressionFactory.createExpression("foo.bar"); Object o = e.evaluate(jc); System.out.println("Return foo.bar: " + o); // try to search for newline... e = ExpressionFactory.createExpression("foo.bar.indexOf('\n')"); o = e.evaluate(jc); System.out.println("Return foo.bar.indexOf('\\n'): " + o); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]