Ask Your Question
1

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

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

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
0

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

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

Comments

thanks super efficient

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

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

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

2 followers

Stats

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

Seen: 1,865 times

Last updated: Apr 17 '15