开发者

delete string content

i fill a string with coordinates , thats working fine. but how can i delete the content of this string.

PS: i use this string in a web services. the web services takes the string and convert it in the typ double.

if i make lat = nil; it dosent work.

here the code:

double degreesLat = newLocation.coordinate.latitude;
lat = [NSString stringWithFormat:开发者_开发技巧@"%1.4f",degreesLat];


lat = @""; 

will work if you just want to set the string to be blank.


NSString is immutable; you can't change the contents of the NSString pointed to by lat in your example code. You can change the NSString instance that lat points to though. For example, you could do:

lat = @""; // sets lat to an empty string

If you want lat to be a string that allows you to change its value, you can use NSMutableString.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜