nsstring

how to remove a particular sign from a string?

让人想犯罪 __ 提交于 2019-12-08 12:56:41
问题 i have a string gpbusd~buy~~~~update~HIT 40 PIPS~HIT 110 PIPS~~gpbusd~buy~~~BREAK EVEN~update~HIT~100+~~gpbusd~buy~1.5500/25~1.5455~~new~40~100+~~gpbusd~buy~~~~update~CLOSE 0 TO 10 PIPS N~~~gpbusd~buy~1.5335/50~1.5320~~new~40~80+~~gpbusd~buy~~~~update~~15-20 PIPS CLOSE~KEEP OPEN~gpbusd~buy~1.5530/50~~1.5505~update~HIT~80~KEEP OPEN~gpbusd~buy~1.5530/50~1.5465~~new~40~80~100+~gbpjpy~sell~131.05/.130.75~132.15~~new~60~100~keep open~eurusd~sell~1.2840/20~1.2870~STOP~update~~~~ i want remove the

Problem uploading NSString to server

一笑奈何 提交于 2019-12-08 11:52:10
问题 I am struggling to get one particular string to upload, using php and mysql I have a number of strings from textfields that will successfully go, this particular string is the text from a label in another viewcontroller. I can see the text with NSLog but for some reason it will not go, I'm confident the server side is working properly as I can pass other strings to that particular row in mySQL. To get the text from the other view I am using - (IBAction)submit:(id)sender; { GetLocation *

How to encode hebrew string (NSString) into a Unicode format in order to send as a URL in Objective-C

穿精又带淫゛_ 提交于 2019-12-08 11:26:14
问题 The title pretty much sums it up. I have a hebrew-containing String used in a NSUrl: NSString * urlS = @"http://irrelevanttoyourinterests/some.aspx?foo=bar&this=that&Text=תל אביב" I would like to convert in into: Text=%u05EA%u05DC%20%u05D0%u05d1%u05d9%u05d1 and then send it as a GET request. I have tried many encoding methods unsuccessfully, and eventually I tried statically inserting the encoded string into the URL, quoted above. NSURL *url1 = [NSURL URLWithString:urlS]; Then I use

return method is failing in a completion block [duplicate]

人盡茶涼 提交于 2019-12-08 11:04:11
问题 This question already has answers here : Return Result of Completion Block (2 answers) Return value for function inside a block (3 answers) Closed 5 years ago . I am having this problem, why can I not RETURN at value : - (NSArray *)SQLRetrieve:(NSString *)barID { self.client = [MSClient clientWithApplicationURLString:@"https://outnight-mobile.azure-mobile.net/" applicationKey:@"okYeRGfBagYrsbkaqWIRObeDtktjkF10"]; [self.client invokeAPI:@"photos" body:barID HTTPMethod:@"POST" parameters:nil

NSAttributedString: Setting FontAttributes doesn't change font

ぃ、小莉子 提交于 2019-12-08 11:02:51
问题 I am trying to change the font on an NSAttributedString. I have a method which iterates over each character, and creates a new NSFontAttribute dictionary for that character. In the end, however, the string remains un-changed. To demonstrate, here is how I setup the string: UIFontDescriptor *fontDescriptor = [UIFontDescriptor fontDescriptorWithName:@"Avenir-Book" size:14.0f]; NSDictionary *fontAttributes = [fontDescriptor fontAttributes]; [fontAttributes setValue:[NSString stringWithFormat:@"

NSMutableData to NSString - how to know which encoding to use for HTTP response

坚强是说给别人听的谎言 提交于 2019-12-08 10:44:10
问题 I'm using Google Protobuf to send a serialized class to an http server. The command to do this is: message.SerializeToString(&out); Notice that we are serializing to a String. The server returns the exact same object back to me. So, in my connection: didReceiveData method, I am getting data. - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData*)data { if (self.receivingData) { [self.dataReceived appendData:data]; } } In my connectionDidFinishLoading method I think I need to

How to convert a JSON array into an NSArray

萝らか妹 提交于 2019-12-08 10:40:02
问题 I've been having trouble finding out how to convert a JSON array into an NSArray. I have a php script that creates an array that is converted into JSON which is then sent and stored into an NSString that looks like: [1,2,3,4] My problem is that I need to make that into an NSArray of ints. How would one do that? Thanks! 回答1: If I wanted to quickly break that into an array I would do it like this: NSString * jstring = @"[1,2,3,4]"; //your json string jstring = [jstring

Making certain words in an NSString bold and clickable like tags [closed]

孤街浪徒 提交于 2019-12-08 10:28:27
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I need to make certain words in a NSString be clickable and a different font style like a tag would. I have a code like so: NSString *str = @"This is my string and it is #cool and #fun. Please click on the tags."; So the above word #cool and #fun would become buttons to a uibutton

Pass by value vs Pass by reference

浪尽此生 提交于 2019-12-08 09:56:40
问题 I have been looking into some basics over the last couple days and I realized that i never truly understood why pass-by-reference for NSString/NSMutableString did not work. - (void)testing{ NSMutableString *abc = [NSMutableString stringWithString:@"ABC"]; [self testing:abc]; NSLog(@"%@",abc); // STILL ABC } -(void)testing:(NSMutableString *)str { str = [NSMutableString stringWithString:@"HELP"]; } How do i go about this? I want my testing method to be able to manipulate the String from the

Example of using NSRegularExpression to detect if string contains Cyrillic

风流意气都作罢 提交于 2019-12-08 09:17:53
问题 I looked into the Apple reference on NSRegularExpression , and understand that in order see if the string is Cyrillic I should use \p{script=cyrillic} . However, I have not been able to find an actual example of how this is done in the reference guide or in an answer located in SO. What I would ideally like to achieve is: if (string contains \p{script=cyrillic}){ return YES; } else { return NO; } 回答1: Maybe (I am an iOS programming newbie): - (BOOL)containsCyrillic:(NSString*)str { NSString*