Reproduced from: HTTP://HI.BAIDU.COM/DAJIAN_ECJTU/ITEM/0A61D297B96B58F8291647BB
"Problem description"
In some cases, the field returned by the server contains spaces that the server developer accidentally knocks out of the data, but the client needs to be protected so that the space in the string is filtered out by the client.
"Problem Analysis"
1, the use of nsstring in the Stringbytrimmingcharactersinset:[nscharacterset Whitespacecharacterset] method is only to remove the space between the left and right sides;
2, the use of nsstring *strurl = [urlstring stringbyreplacingoccurrencesofstring:@ "" withstring:@ "]; You can remove spaces, Note that the generated strURL is Autorelease property and do not attempt to release the strURL. , the server returned the field contains spaces, this space is the server developers accidentally to the data to knock more, but the client needs protection, so the client needs to filter out the space in the string.