I have the following issue in swift
I have a String
let GET_LISTING = "Listing/GetDetails?deviceid=%@&listingid=%d";
the I use this line to get it formatted
let url = SERVER_URL + String.localizedStringWithFormat(GET_LISTING, deviceId, listingId);
when the number < 1000 it works fine
for example
Listing/GetDetails?deviceid=AB11F1D0-153E-48C3-950F-CC773BBCC683&listingid=500
if number > 1000 it is wrong
Listing/GetDetails?deviceid=AB11F1D0-153E-48C3-950F-CC773BBCC683&listingid=1,050
how can I solve this problem ?
stringWithFormatfunction instead oflocalizedStringWithFormat?let url = SERVER_URL + String.localizedStringWithFormat(GET_LISTING, deviceId, String(listingId));String(format:, arguments:)constructor in swift. Also, you should consider using String interpolation:"Listing/GetDetails?deviceid=\(deviceId)&listingid=\(listingId)"