• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: formatted strings in Swift
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: formatted strings in Swift


  • Subject: Re: formatted strings in Swift
  • From: Lou Zell <email@hidden>
  • Date: Sat, 03 Sep 2016 09:15:16 -0700

On Fri, Sep 2, 2016 at 10:02 PM, Gerriet M. Denkmann <email@hidden>
wrote:
>
> How to create a formatted string?
>

I use a little helper workaround that essentially looks like this:

let str = "hi".nulTerminatedUTF8
let padded = str.withUnsafeBufferPointer() {
    return String(format: "s", $0.baseAddress!)
}
print(padded)
// prints:    hi
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >formatted strings in Swift (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Re: formatted strings in Swift
  • Next by Date: Re: formatted strings in Swift
  • Previous by thread: Re: formatted strings in Swift
  • Next by thread: Get file argument
  • Index(es):
    • Date
    • Thread