Notes to self
Monday, February 25, 2008
String: extract a single character
Whenever I wanted to extract a single character from a string, invariably I started with something like "hello"[1] and Ruby returns 104. That's the ascii code for 'h'. Its not at all useful. I should practice saying "hello"[0,1] which will return what I want, i.e. 'h'.
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2008
(51)
-
▼
February
(12)
- square brackets [] class method of Hash
- Preventing sensitive data from being logged in Rai...
- Route Globbing
- String: extract a single character
- require and load won't reload the file with reload...
- Rails without a database
- eval
- binding in ruby
- ActiveRecord tricks - :include and :select options
- Convert String to Range
- Prevent a class from instantiating
- SQL joins explained
-
▼
February
(12)
No comments:
Post a Comment