Studiose Well I guess that's that.

MString

Posted on May 25, 2010

Programmed my own little string class based off std::string. It's nothing special, but it's nice to have my function to edit while I need it, this way I don't need to make tons of code changes over 10 different files to do one thing, instead I can just add the function to the class or edit one and bam!

So far the only functions I've added to the Mobility String that aren't standard in a normal string are:

  • MString MakeUpper(), which converts the string to all caps.
  • MString MakeLower(), the exact same as MakeUpper() but to lowercase.
  • MString Chunk( int begin, int end ), just a simplified substr function. Parameter "end" is optional, if it's not provided it just starts from "begin" and goes t'll the end of the string.
  • const wchar_t *WStr(), returns the string in a wide character array.
  • static const char *Narrow( wchar_t *str ), returns a given wide array as a simple char array. Because it's static you can use it outside a specific object.
  • static const wchar_t *Widen( char *str ), the exact same as Narrow( wchar_t *str ) but widens the char array.

Obviously it isn't complete, but I'll add features as I need them. Which is the beauty of this class for me. Anyways, off to copying Garry's Hot Compiling.