Ask Your Question

how do i convert float to integer within a manifest without using stdlib

asked 2015-04-15 23:04:40 -0600

whyme gravatar image

how do i convert $result = 25.00 to $result=25 without using stdlib

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-04-17 01:11:07 -0600

ramindk gravatar image

Inline templates are usually the easiest way to manipulate data within a manifest.

 $result = inline_template("<%= @my_var.to_i %>")

Writing a custom function would work, but now you're recreating code that's in stdlib. Seems easier to just require it.

edit flag offensive delete link more


thanks super efficient

whyme gravatar imagewhyme ( 2015-04-21 19:04:30 -0600 )edit

answered 2015-04-16 09:54:39 -0600

whyme gravatar image

I wrote a custom function for converting the float to integer. But if anyone else has any suggestions, always willing to listen for better ideas. Thanks

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2015-04-15 23:04:40 -0600

Seen: 2,061 times

Last updated: Apr 17 '15