July 26 2010 by
Ryan Carter in
Ruby |
To convert a string or other object into an integer (number) do this: "23".to_i This will produce 23 (as a number) If you do something like this: "Hello".to_i You will get 0 returned, because Ruby can’t understand that object and translate it into a number.
July 26 2010 by
Ryan Carter in
Ruby |
To convert a number to a string in Ruby, do this: 40.to_s
If you want to perform a sum or count on the records in a DataTable, you can, very simply. You’ll have to have a DataTable with something in it, like results from a database, then you do this: // my DataTable is full of customer data and is named "dt" object newCustomerCount = dt.Compute("count(id)","CustomerID > [...]