I have an IP address and I need to manipulate the final octet in a few different ways. For example,
And I want to end up with:Code:str = 10.100.100.0
Code:newStr1 = 10.100.100.Now the IP address length may vary so I can't spilt up on string length, I need to split up after the 3rd occurence of '.' .Code:newStr2 = 10.100.100.1
In PHP I'd use substr_replace but I can't find a Ruby equivilant.