Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Replace string function in BIRT
srikala
I have data coming in like this
"Upload up to^six lines of^text information and your^320x240 bitmap using the^Onboard Administrator^web user" .
How can i replace ^ with spaces. Please help.
Find more posts tagged with
Comments
bgbaird
var str="Upload up to^six lines of^text information and your^320x240 bitmap using the^Onboard Administrator^web user";
str=str.replace(/\^/g," ");
johnw
In the expression for your Data element for that field (lets say it is called Description), you would change it from:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>row["Description"]</pre>
<br />
to<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>var javaString = (new Packages.java.lang.String(row["Description"]));
javaString.replace("^", " ");</pre>
<br />
Forcing it as a Java string instead of a Javascript string is necessary because the replace method will not replace all in Javascript.
bgbaird
Not to be picky, but the switch "g" applies it to the entire string