[fxruby-users] ProgressiveSelectTextField

Jannis Pohlmann info at sten-net.de
Wed Mar 1 15:41:02 EST 2006


On Wed, 1 Mar 2006 20:25:13 +0100
Uwe Hartl <uwe.hartl at gmx.net> wrote:

> Ok, I will fix these. I started programming a couple of weeks ago in
> ruby after a 9 year brake, coming fron C. Sorry, I will improve.
> 
> A couple of things I would need help with:
> 
> I tried "fillItems" from the FXList and get a segfault. Thats why I
> wrote append_array(txt). Can somebody verify this, please? In my case
> we look at an Gentoo system, I have no idea if this is system
> specific.
> 
> I want to have a String: "blabla\(blabla" to make the "(" a normal
> character for the regex;
> 
> Here are my Attempts
> irb(main):089:0* "blabla\(blabla"
> => "blabla(blabla"
> irb(main):090:0> "blabla\\(blabla"
> => "blabla\\(blabla"
> irb(main):091:0> 'blabla\\(blabla'
> => "blabla\\(blabla"
> 
> Can somebody tell me how I can do this? I either get two backslashes
> or I get none. What do I miss?

You're missing that irb displays stuff (almost) the way Ruby is
interpreting it. 

"\(" would always become "(" because Ruby tries to interpret the
backslash as a special char (\n, \r, \t etc.) but fails to find a 'r',
'n' or 't', so the slash is just ignored. To check this, try typing 
"blabla\t(blabla", which will give you "blabla\t(blabla".

Irb returns "\\(" as "\\(", but this doesn't mean that there will be two
backslashes in the actual string output. If it would print "\" you might
expect a special char here (=> misleading).

To check your expressions, assign the string to a variable and print
its value:

jannis at nebelsee ~> irb
irb(main):001:0> var = "bla\test"
=> "bla\test"
irb(main):002:0> puts var
bla     est
=> nil
irb(main):003:0> var = "bla\\test"
=> "bla\\test"
irb(main):004:0> puts var
bla\test
=> nil
irb(main):005:0> var = "bla\(test"
=> "bla(test"
irb(main):006:0> puts var
bla(test
=> nil
irb(main):007:0> var = "bla\\(test"
=> "bla\\(test"
irb(main):008:0> puts var
bla\(test
=> nil

Hope this helps,
Jannis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20060301/acacdf1f/attachment.bin


More information about the fxruby-users mailing list