Revision: 3704 http://vexi.svn.sourceforge.net/vexi/?rev=3704&view=rev Author: mkpg2 Date: 2009-10-09 17:14:21 +0000 (Fri, 09 Oct 2009)
Log Message: ----------- New string method, trim() Modified Paths: -------------- trunk/core/org.ibex.js/src/org/ibex/js/JSPrimitive.jpp trunk/core/org.ibex.js/src_junit/test/js/exec/string/TestString.java Added Paths: ----------- trunk/core/org.ibex.js/src_junit/test/js/exec/string/trim.js Modified: trunk/core/org.ibex.js/src/org/ibex/js/JSPrimitive.jpp =================================================================== --- trunk/core/org.ibex.js/src/org/ibex/js/JSPrimitive.jpp 2009-10-09 00:24:57 UTC (rev 3703) +++ trunk/core/org.ibex.js/src/org/ibex/js/JSPrimitive.jpp 2009-10-09 17:14:21 UTC (rev 3704) @@ -93,6 +93,7 @@ return JSU.S(JSU.toString(this)); } case "toUpperCase": return JSU.S(s.toUpperCase()); + case "trim": return JSU.S(s.trim()); //#end return super.callMethod(this_, method, args); } @@ -237,6 +238,8 @@ case "toString": return METHOD; /* Returns the upper-case equivalent of the current string. @return(String) */ case "toUpperCase": return METHOD; + /* Returns the string with leading and trailing whitespace removed. @return(String) */ + case "trim": return METHOD; //#end return super.get(key); } Modified: trunk/core/org.ibex.js/src_junit/test/js/exec/string/TestString.java =================================================================== --- trunk/core/org.ibex.js/src_junit/test/js/exec/string/TestString.java 2009-10-09 00:24:57 UTC (rev 3703) +++ trunk/core/org.ibex.js/src_junit/test/js/exec/string/TestString.java 2009-10-09 17:14:21 UTC (rev 3704) @@ -10,7 +10,7 @@ public static void main(String[] args) throws Throwable { JSTestSuite jts = new JSTestSuite(TestString.class); - String SCRIPT = "replace.js"; + String SCRIPT = "trim.js"; //String SCRIPT = "testNumber2String.js"; TestCase t = jts.createTestCase(jts.getResourceDirs(), SCRIPT); t.runBare(); Added: trunk/core/org.ibex.js/src_junit/test/js/exec/string/trim.js =================================================================== --- trunk/core/org.ibex.js/src_junit/test/js/exec/string/trim.js (rev 0) +++ trunk/core/org.ibex.js/src_junit/test/js/exec/string/trim.js 2009-10-09 17:14:21 UTC (rev 3704) @@ -0,0 +1,6 @@ +sys.import("lib"); + +var foo = " \n what a mess "; +var bar = foo.trim(); +sys.trace(bar); +assertEquals("what a mess", bar); \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn