Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tut] Fun with Strings
#4
(01-14-2010, 07:44 PM)trilobyte- Wrote: I'm not sure about regular expressions, but I heard my mate is making a tut. Tongue
And for replacing in a strign, I think it's something using GSUB.
Like;
Code:
puts "Jordan".gsub("J", "X")
Would change J to X, making it Xordan.

I think that's how it works anyway, I don't know, try it. Mark (Wolskie) taught me that Smile


Yes that worked, thanks!
And about the regular expressions, they work with the same function...

This code will convert every letter lowercase and uppercase from a-z with to the number 0...
Code:
puts "Jordan".gsub(/[A-Za-z]/, "0")
Reply


Messages In This Thread
[Tut] Fun with Strings - by Jordan L. - 01-14-2010, 06:53 PM
RE: [Tut] Fun with Strings - by Gaijin - 01-14-2010, 07:07 PM
RE: [Tut] Fun with Strings - by Jordan L. - 01-14-2010, 07:44 PM
RE: [Tut] Fun with Strings - by Gaijin - 01-14-2010, 07:55 PM
RE: [Tut] Fun with Strings - by Jordan L. - 01-14-2010, 08:07 PM
RE: [Tut] Fun with Strings - by Gaijin - 01-14-2010, 08:11 PM
RE: [Tut] Fun with Strings - by Jordan L. - 01-14-2010, 08:14 PM
RE: [Tut] Fun with Strings - by Gaijin - 01-17-2010, 06:34 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)