Examples of RightSubstring


Examples of org.apache.imperius.spl.parser.expressions.impl.RightSubstring

    try {
      Vector v = new Vector();
      v.add(new StringConstant(string));
      v.add(ic4);
      v.add(lr);
      Expression esnl = new RightSubstring(v,true);
      // Examples: RightSubstring("AutonomicComputing", 4, LeftToRight) = "ting".

      v.clear();
      v.add(new StringConstant(string));
      v.add(icmin1);
      v.add(lr);
      Expression esnlmin1 = new RightSubstring(v,true);
      // Examples: RightSubstring("AutonomicComputing", -1, LeftToRight) = "AutonomicComputing".

      v.clear();
      v.add(new StringConstant(string));
      v.add(ic4);
      v.add(rl);
      Expression esnr = new RightSubstring(v,true);
      // RightSubstring("AutonomicComputing", 4, RightToLeft) = "nomicComputing".<p>

      v.clear();
      v.add(new StringConstant(string));
      v.add(icmin1);
      v.add(rl);
      Expression esnrmin1 = new RightSubstring(v,true);
      // Examples: RightSubstring("AutonomicComputing", -1, RightToLeft) = "".

      v.clear();
      v.add(new StringConstant(string));
      v.add(new StringConstant("\"om\""));
      v.add(lr);
      Expression essl = new RightSubstring(v,true);
      // Examples: RightSubstring("AutonomicComputing", "om", LeftToRight)="icComputing"

      v.clear();
      v.add(new StringConstant(string));
      v.add(new StringConstant("\"jj\""));
      v.add(lr);
      Expression esslne = new RightSubstring(v,true);
      // Examples: RightSubstring("AutonomicComputing", "jj", LeftToRight)=""

      v.clear();
      v.add(new StringConstant(string));
      v.add(new StringConstant("\"om\""));
      v.add(rl);
      Expression essr = new RightSubstring(v,true);
      // RightSubstring("AutonomicComputing", "om", RightToLeft)="puting".

      v.clear();
      v.add(new StringConstant(string));
      v.add(new StringConstant("\"jj\""));
      v.add(rl);
      Expression essrne = new RightSubstring(v,true);
      // RightSubstring("AutonomicComputing", "jj", RightToLeft)="".

      assertTrue(((String) esnl.evaluate()).equals("ting"));
      assertTrue(
          ((String) esnlmin1.evaluate()).equals(
          "AutonomicComputing"));
      assertTrue(
          ((String) esnr.evaluate()).equals("nomicComputing"));
      assertTrue(((String) esnrmin1.evaluate()).equals(""));
      assertTrue(((String) essl.evaluate()).equals("icComputing"));
      assertTrue(((String) esslne.evaluate()).equals(""));
      assertTrue(((String) essr.evaluate()).equals("puting"));
      assertTrue(((String) essrne.evaluate()).equals(""));
    } catch (SPLException e) {
      fail("Received evaluation exception " + e.getMessage());
    } catch (Exception e) {
      fail("Received expression exception " + e.getMessage());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.