I have an NSString that is a local IP Address, and I need to remove the last set of digits on this IP Address and replace with 255. I am doing this to create broadcast packet from the local IP Address.
I have checked all the available string manipulation functions and cannot find a Left function, which would help for this situation.
Basically I want to do this:-
Convert 192.168.1.10 to 192.168.1.255
Edit: Please note the following information for calculating the broadcast address for a network. It is calculated by performing a bitwise OR with the IP Address and the inverted Netmask. You can see a calculator here - http://www.subnet-calculator.com/
Also the actual code on how to calculate the broadcast address is available here - Calculating the Broadcast Address in Objective-C
This was added to avoid any confusion created with my question.