Ruby On Rails

Showing posts with label primary data types. Show all posts
Showing posts with label primary data types. Show all posts

Saturday, October 15, 2011

Converting between values and char

// character to ASCII value: use ?
?a     # => 97
?\n # => 10


// string to integer: use []
'a'[0]        # => 97
'hallo'[1] # => 97


// integer / number to character: use .chr
97.chr     # => "a"
10.chr # => "\n"
Posted by Rekha Kumari at 12:52 PM No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: primary data types
Older Posts Home
Subscribe to: Posts (Atom)

Blog Archive

  • ▼  2011 (28)
    • ▼  October (28)
      • Checking for pallindrome in ruby
      • Converting between values and char
      • Ruby from perspective of other programming languages
      • Primary types in Ruby
      • Comparison of operators with c or other languages
      • Things to remember for ruby
      • Methods and attributes
      • Named parameters in ruby
      • Creating Classes
      • self: Referencing to the current receiver
      • $(function(){$('#tweets').tweetable({username: 'bl...
      • Getters and setters in Ruby class
      • Class level variables in ruby
      • initialize in Ruby vs constructor in Java or cpp
      • Defining functions in ruby
      • Modules and Mixins
      • Built-in classes in Ruby
      • Symbol in ruby
      • Making immutable objects
      • Variables as reference to objects
      • Creating an object in ruby
      • Objects in Ruby
      • Ruby Loops
      • Sample Program in Ruby
      • Operators and precedence in Ruby
      • Comment in Ruby
      • Variables in Ruby
      • Ruby Keywords

About Me

Rekha Kumari
View my complete profile
Simple theme. Powered by Blogger.