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)
Displaying a string "ABC Def GHi" in "Abc Def Ghi" manner
RRK
<p>Hi,</p>
<p> </p>
<p>In BIRT we have upper() function lower() function but do we have a function which displays text having First letter of the word in capital and remaining in lower case.</p>
<p>eg: "ABC Def GHi" - > "Abc Def Ghi"</p>
<p> </p>
<p>how can we achieve it ?</p>
<p> </p>
<p> </p>
<p>Thanks in advance!!!</p>
Find more posts tagged with
Comments
Matthew L.
<p>I found a solution in the comments of the following StackOverflow post: <a data-ipb='nomediaparse' href='
http://stackoverflow.com/a/8330107'>http://stackoverflow.com/a/8330107</a></p>
;
<p> </p>
<p>I added a .toLowerCase() from the original post example to lowercase the remaining string.</p>
<pre class="_prettyXprint _lang-js">
var output = capitaliseFirstLetters("ABC Def GHi"); //Call function
//Function can go in reports initialize method to be called from within the report
function capitaliseFirstLetters(s){ return s.split(" ").map( function(w){ return w.charAt(0).toUpperCase() + w.substr(1).toLowerCase() } ).join(" ") }
</pre>
RRK
<p>Thanks Matthew ...</p>
<p> </p>
<p>It worked placidly...</p>