Forum: Ruby generating CReturn in xml file

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Josselin (Guest)
on 2007-06-01 21:35
(Received via mailing list)
I am generating an xml output file from my rails app to be read in
Flash.. working fine as long as I don't have to insert a CR in a string
to be understood by Flash

Flash can understand the CR if the character  
 is embedded  (ASCII
code for CR)

so if I have a string like "Announce 14
at 04/04/2007", it will
display correctly into my Flash object as

Announce 13
at 04/04/2007

my problem is how to generate the string, I tried :

name_label = "Announce " + proposition.id.to_s + "\nat " +
post.created_at.utc.strftime("%d/%b/%Y")
but it's not working
I also tried ....
name_label = "Announce " + proposition.id.to_s + "
at " +
post.created_at.utc.strftime("%d/%b/%Y")
not working
...  how can I put this character sequence as it ?

thanks for your help

joss
Brian C. (Guest)
on 2007-06-01 22:51
(Received via mailing list)
On Sat, Jun 02, 2007 at 02:35:15AM +0900, Josselin wrote:
>
> name_label = "Announce " + proposition.id.to_s + "\nat " +
> post.created_at.utc.strftime("%d/%b/%Y")
> but it's not working
> I also tried ....
> name_label = "Announce " + proposition.id.to_s + "
at " +
> post.created_at.utc.strftime("%d/%b/%Y")
> not working
> ...  how can I put this character sequence as it ?

"\r" is character 13. "\n" is character 10.

$ irb1.8
irb(main):001:0> "\r"[0]
=> 13
Josselin (Guest)
on 2007-06-02 10:05
(Received via mailing list)
On 2007-06-01 20:51:13 +0200, Brian C. <removed_email_address@domain.invalid> 
said:

>> my problem is how to generate the string, I tried :
> "\r" is character 13. "\n" is character 10.
>
> $ irb1.8
> irb(main):001:0> "\r"[0]
> => 13

thanks Brian...  I was mixin chracter sets.....   \r is the right one
... it runs very well..
my Flash app is very happy to get it....

joss
This topic is locked and can not be replied to.