Discarding everything in a string variable after the second decimal
I have a Ruby string variable with the value 1.14.2.ab3-4.dl0.rhel However, I want to discard everything after the second decimal so that I get the value as 1.14
I am using the following command: str.split(".")[0] but it doesn't seem to work
Aucun commentaire:
Enregistrer un commentaire