Jump to content
  • Advertisement
Sign in to follow this  
Decept

How to convert C# string to Obj-C string

This topic is 3202 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm making a level editor in C# for my Obj-C iPhone game. Now I need to save strings with filenames in the level file (binary data) and have them loaded on the iPhone. How should I save and load the strings? Also, I don't have much use for other encodings than latin ascii, as these are filenames. But it would be nice to be able to save unicode strings later on for in-game text.

Share this post


Link to post
Share on other sites
Advertisement
I know there is a way to get an UTF8 byte array in .NET, I'm thinking it is this class here. According to a quick google search that gave this, if that is an Obj-C string(never messed with Obj-C), you should be able to create the NSString from the UTF8 byte array.

I know nothing about Obj-C, so don't take this for gospel.

Share this post


Link to post
Share on other sites
If you just wish for a 7-bit ASCII array of bytes, Encoding.ASCII.GetBytes(someString) will do the trick (any character not representable in ASCII will be replaced with a ?).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!