Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Carriage return in OCL expressions
Carriage return in OCL expressions [message #60028] Fri, 01 August 2008 10:24 Go to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060706000403050301090105
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I was trying to create a String containing a carriage return through an
OCLExpression such as 'random string'.concat('\n') and ended up with a
java String looking as "random string\\n" so OCL automatically escaped
my "\". Indeed the String is then exactly as I wrote it ... except it
means I cannot concatenate control characters in an OCL String.

Is that the expected behavior for OCL Strings? If so, is there a known
way to have a carriage return inserted into a String via OCL?

Thanks

Laurent Goubet
Obeo

--------------060706000403050301090105
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

begin:vcard
fn:Laurent Goubet
n:Goubet;Laurent
org:<a href="http://www.obeo.fr/">Obeo</a>
email;internet:laurent.goubet@obeo.fr
url:http://www.obeo.fr
version:2.1
end:vcard


--------------060706000403050301090105--
Re: Carriage return in OCL expressions [message #60100 is a reply to message #60028] Fri, 01 August 2008 13:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Laurent,

The OCL Specification does not make any provision for handling of
control characters. What do you get if you simply embed a newline in
the string, as in

'this is
an example'

Actually, I had expected that '\n' would work. AFAIK, the grammar is
supposed to have implemented that.

Would you mind raising a bug?

Thanks,

Christian


laurent Goubet wrote:
> Hi,
>
> I was trying to create a String containing a carriage return through an
> OCLExpression such as 'random string'.concat('\n') and ended up with a
> java String looking as "random string\\n" so OCL automatically escaped
> my "\". Indeed the String is then exactly as I wrote it ... except it
> means I cannot concatenate control characters in an OCL String.
>
> Is that the expected behavior for OCL Strings? If so, is there a known
> way to have a carriage return inserted into a String via OCL?
>
> Thanks
>
> Laurent Goubet
> Obeo
Re: Carriage return in OCL expressions [message #60124 is a reply to message #60100] Fri, 01 August 2008 14:13 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000501000002070201090008
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Christian,

Well in my case embedding a plain new line in the String is not a
solution as the project I'm working is in its early stages and a plain
new line would have to be handled too ;).

I raised https://bugs.eclipse.org/bugs/show_bug.cgi?id=242880 to record
this problem.

Laurent Goubet
Obeo

Christian W. Damus a
Previous Topic:Converting query result for EMF serialization?
Next Topic:String operation - trim function
Goto Forum:
  


Current Time: Tue Apr 23 10:21:34 GMT 2024

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

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

Back to the top