Pythong String format to NSString

Discussion in 'iOS Programming' started by Oblivionixx, Jul 11, 2011.

  1. Oblivionixx macrumors newbie

    Mar 11, 2011
    I am working on a project which I am going to implement an UI for IPad while the original UI is written in Python.
    Here is a Python script written in the original UI:

    msg = '%8s\0%8s\0%8s\0%s\0'(dst,code,appcode,data)
    size = len(msg)+9
    I need to make the same message and put it into the NSStream for sending to a remote server. How can I convert the script into NSString format?

    Thanks in advance.
  2. RonC macrumors regular

    Oct 18, 2007
    I could tell you exactly what to do, but you need to learn how to do it yourself.

    You should read String Programming Guide and pay attention to the section on Formatting String Options. A couple of corresponding documents to look at are String Format Specifiers and the IEEE printf specification.

    You'll be able to figure it out. If you can't figure it out from those, write some code and show us what you can figure out. We can help from there, but we're not going to do your work for you.

Share This Page