%f and others in NSStrings
-
NSString *someString = [NSString stringWithFormat:@"%d and some text here",
someIntHere];
___
Sent with SnapperMail
www.snappermail.com
...... Original Message .......
On Thu, 26 Aug 2004 13:41:36 -0400 Lee Morgan <leeamorgan...>
wrote:
> Is there some simple way in Cocoa to do the following...http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
> string = "%d and some text here", someIntHere
>
> I've looked around a bit, but the only way I see is to convert
> someNumber into a NSNumber then take its stringValue and append it and
> other strings to a mutablestring as needed. Seems overly complex for
> something so simple - so I bet I'm missing something.
>
> - lee
> _______________________________________________
> cocoa-dev mailing list | <cocoa-dev...>
> Help/Unsubscribe/Archives:
> Do not post admin requests to the list. They will be ignored._______________________________________________
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
Is there some simple way in Cocoa to do the following...
string = "%d and some text here", someIntHere
I've looked around a bit, but the only way I see is to convert
someNumber into a NSNumber then take its stringValue and append it and
other strings to a mutablestring as needed. Seems overly complex for
something so simple - so I bet I'm missing something.
- lee
_______________________________________________
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
Here are a couple of ways:
NSString *string = [NSString stringWithFormat:@"%d and some text
here\n", someIntHere];
NSString *string = [NSString localizedStringWithFormat:@"%d and some
text here\n", someIntHere];
Chuck
At 1:41 PM -0400 8/26/04, Lee Morgan wrote:
> Is there some simple way in Cocoa to do the following..._______________________________________________
>
> string = "%d and some text here", someIntHere
>
> I've looked around a bit, but the only way I see is to convert
> someNumber into a NSNumber then take its stringValue and append it
> and other strings to a mutablestring as needed. Seems overly complex
> for something so simple - so I bet I'm missing something.
>
> - lee
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
How about:
NSString *aString = [NSString stringWithFormat: @"The int: %d",
someInt];
j o a r
On 2004-08-26, at 19.41, Lee Morgan wrote:
> Is there some simple way in Cocoa to do the following...
>
> string = "%d and some text here", someIntHere
>
> I've looked around a bit, but the only way I see is to convert
> someNumber into a NSNumber then take its stringValue and append it and
> other strings to a mutablestring as needed. Seems overly complex for
> something so simple - so I bet I'm missing something.
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
Thanks. I knew there had to be something a lot simpler.
- lee
On Aug 26, 2004, at 12:07 PM, Tim Hart wrote:
> NSString *someString = [NSString stringWithFormat:@"%d and some text_______________________________________________
> here",
> someIntHere];
> ___
> Sent with SnapperMail
> www.snappermail.com
>
> ...... Original Message .......
> On Thu, 26 Aug 2004 13:41:36 -0400 Lee Morgan <leeamorgan...>
> wrote:
>> Is there some simple way in Cocoa to do the following...
>>
>> string = "%d and some text here", someIntHere
>>
>> I've looked around a bit, but the only way I see is to convert
>> someNumber into a NSNumber then take its stringValue and append it and
>> other strings to a mutablestring as needed. Seems overly complex for
>> something so simple - so I bet I'm missing something.
>>
>> - lee
>> _______________________________________________
>> cocoa-dev mailing list | <cocoa-dev...>
>> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>> Do not post admin requests to the list. They will be ignored.
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
At 13:41 Uhr -0400 26.08.2004, Lee Morgan wrote:
> Is there some simple way in Cocoa to do the following...
>
> string = "%d and some text here", someIntHere
>
> I've looked around a bit, but the only way I see is to convert
> someNumber into a NSNumber then take its stringValue and append it
> and other strings to a mutablestring as needed. Seems overly complex
> for something so simple - so I bet I'm missing something.
string = [NSString stringWithFormat: @"%d and some text here", someIntHere];
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
On 26 Aug 2004, at 19:41, Lee Morgan wrote:
> Is there some simple way in Cocoa to do the following...You want [NSString stringWithFormat:@"foo=%d",foo]; It works the same
>
> string = "%d and some text here", someIntHere
>
> I've looked around a bit, but the only way I see is to convert
> someNumber into a NSNumber then take its stringValue and append it and
> other strings to a mutablestring as needed. Seems overly complex for
> something so simple - so I bet I'm missing something.
>
as printf, but you also use %@ to print objects.
Fred
> - lee_______________________________________________
> _______________________________________________
> cocoa-dev mailing list | <cocoa-dev...>
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.



