Convert a String to float/decimal using liquid?

I feel embarrassed by asking this question but I can’t seem to find a string filter that will convert to a float/decimal number. I know the to_i does a nice conversion to int–but I tried to_f, float, decimal, etc. with no luck. I’ve googled my brains out thinking it is such a basic function but have only found folks talking about converting a float to a string, not the other way around.

My Google-Fu has failed me. All help is appreciated!

I assume javascript?

parseFloat()?

My apologies. I meant using liquid–I know I could do it using javascript. Just looking for a cleaner approach. I have updated the title.

float_number = string_number | times: 1.0
2 Likes

Thanks! That works.

1 Like