|
Re: split(".") does not work [message #724284 is a reply to message #724275] |
Sun, 11 September 2011 23:23 |
Ed Merks Messages: 33149 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 #724554 is a reply to message #724494] |
Mon, 12 September 2011 13:54 |
|
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:-(
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03288 seconds