Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » split(".") does not work(BIRT Report Designer with BIRT v2.5.2 - split(".") does not work)
split(".") does not work [message #724275] Sun, 11 September 2011 21:46 Go to next message
LBck  is currently offline LBck Friend
Messages: 3
Registered: September 2011
Junior Member
Hi,
I'm using BIRT Report Designer with BIRT v2.5.2 .
In my report, I tried with
var sArr = paragraph.split(".");
in order to split a paragraph (e.g "Hi, there. I am working now. Please come later.") into sentences. The returned result was sArr.length = 0 - the paragraph was not splitted. Sad
However when I tried again with comma as delimiter
var sArr = paragraph.split(",") ;
It works:
sArr[0] = Hi
sArr[1] = there. I am working now. Please come later.
It seems to be weird. Is that any exception on the colon delimiter which I missed or is that a problem with code or the development environmen?
Thanks much in advance.
Lien
Re: split(".") does not work [message #724284 is a reply to message #724275] Sun, 11 September 2011 23:23 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Lien,

Just a guess, but if the argument is a regular expression then "." has
special meaning (match any character) whereas "," just means comma. So
try using "\\." (an escaped dot, and of course the backslash itself
needs to be escaped, at least in Java so probably in whatever language
this is).

On 11/09/2011 2:46 PM, LBck wrote:
> Hi,
> I'm using BIRT Report Designer with BIRT v2.5.2 . In my report, I
> tried with
> var sArr = paragraph.split(".");
> in order to split a paragraph (e.g "Hi, there. I am working now.
> Please come later.") into sentences. The returned result was
> sArr.length = 0 - the paragraph was not splitted. :( However when I
> tried again with comma as delimiter
> var sArr = paragraph.split(",") ;
> It works:
> sArr[0] = Hi
> sArr[1] = there. I am working now. Please come later.
> It seems to be weird. Is that any exception on the colon delimiter
> which I missed or is that a problem with code or the development
> environmen?
> Thanks much in advance.
> Lien
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: split(".") does not work [message #724494 is a reply to message #724284] Mon, 12 September 2011 13:23 Go to previous messageGo to next message
LBck  is currently offline LBck Friend
Messages: 3
Registered: September 2011
Junior Member
Hi Ed,

Thanks. I tried with "//." but pity that it has not resolved the problem:-(

by the way. I am using javascript.

[Updated on: Mon, 12 September 2011 14:23]

Report message to a moderator

Re: split(".") does not work [message #724554 is a reply to message #724494] Mon, 12 September 2011 13:54 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I just tried this with 2.5.2 and it worked for me. I created a blank
report and added a data item with a type of string and the following
expression.

var par = "Hi, there. I am working now. Please come later."
var sArr = par.split(".") ;
sArr[1];

Jason

On 9/12/2011 9:23 AM, LBck wrote:
> Hi Ed,
>
> Thanks. I tried with "//." but pity that it has not resolved the problem:-(
>
>
Previous Topic:Dynamically change line chart or bar chart with on-screen slider
Next Topic:OSGI nor found BIRT3.7 JBOSS
Goto Forum:
  


Current Time: Sat Apr 20 03:43:26 GMT 2024

Powered by FUDForum. Page generated in 0.03674 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top