[Q] Garbage strings appened to a string
[Q] Garbage strings appened to a string
- Subject: [Q] Garbage strings appened to a string
- From: JongAm Park <email@hidden>
- Date: Mon, 26 Sep 2005 21:20:02 -0700
Hello.
When I tried manipulating strings, I found something strange. Probably I
don't understand how the NSString works well.
A NSTextField is connected to an outlet. Let's call it myTextField.
Now, an NSString is retrieved from it.
NSString *aString = [myTextField stringValue];
If it is printed or put into another text field like this
NSString *outputString = [ NSString stringWithFormat:@"%S is being
typed.", [aString cStringUsingEncoding: NSUnicodeStringEncoding] ];
[outputTextField setStringValue:outputString];
Let's say that an input string is "Hello, Jane", and there is an OK
button which put the input string into the outputTextField with the
format above.
Whenever the OK button is pressed, some garbages are appended to the
"Hello, Jane". Sometimes it is OK, though.
Can anyone tell me why this inconsistent result is obtained? Is there
something wrong about the syntax? (Other than probable typo. : ) )
Thank you.
JongAm Park
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden