decimal_places(x = 2.851)
decimal_places(x = "2.851")
# Trailing zeros are only counted in strings:
decimal_places(x = c(7.3900, "7.3900"))
# Whitespace at the end of a string is ignored:
decimal_places(x = "6.0 ")
Run the code above in your browser using DataLab