Chapter 3. Working with Regular Expressions


2.41. Conclusion

Here we have seen the basics of representing strings (both single-quoted and double-quoted). We've seen how to interpolate expressions into double-quoted strings, and how the double quotes also allow certain special characters to be inserted with escape sequences. We've seen the %q and %Q forms, which permit us to choose our own delimiters for convenience. Finally, we've seen the here-document syntax, carried over from older contexts such as Unix shells.

This chapter has demonstrated all the important operations a programmer wants to perform on a string. These include concatenation, searching, extracting substrings, tokenizing, and much more. We have seen how to iterate over a string by line or by byte. We have seen how to transform a string to and from a coded form such as base64 or compressed form.

It's time now to move on to a related topicregular expressions. Regular expressions are a powerful tool for detecting patterns in strings. We'll cover this in the next chapter.




The Ruby Way(c) Solutions and Techniques in Ruby Programming
The Ruby Way, Second Edition: Solutions and Techniques in Ruby Programming (2nd Edition)
ISBN: 0672328844
EAN: 2147483647
Year: 2004
Pages: 269
Authors: Hal Fulton

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net