Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 354765

Summary: JS: only first instance of substring is replaced using replaceStr
Product: z_Archived Reporter: Kathy Carroll <carrollk>
Component: EDTAssignee: Project Inbox <edt.javascriptgen-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: greer
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Kathy Carroll CLA 2011-08-15 15:18:52 EDT
handler MyHandler type RUIhandler {onConstructionFunction = start, cssFile="css/Alpha.css", title="MyHandler"}
	function start()
		SysLib.WriteStdOut("Hello from JavaScript Batch");
		replaceTest();
	end
	
	function replaceTest()
		actualStr String = "abcdefabcdefabcdefab".replaceStr("abc", "xyz");
        expectedStr string = "xyzdefxyzdefxyzdefab";
		if (actualStr == expectedStr)
			syslib.writeStdout("works");
		else
			syslib.writeStdout("fails");
			syslib.writeStdout(actualStr);
			syslib.writeStdout(expectedStr);
		end
	end
end

Output is:
Hello from JavaScript Batch
fails
xyzdefabcdefabcdefab
xyzdefxyzdefxyzdefab
Comment 1 Scott Greer CLA 2011-09-07 22:51:06 EDT
Added correct impl. of replaceStr, verified provided testcase.
Comment 2 Kathy Carroll CLA 2011-09-08 11:15:14 EDT
Verified with 0.7.0v201109080902.
Comment 3 Lisa Lasher CLA 2011-10-11 16:12:53 EDT
Closing this defect.