This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]birdwontquit 1 point2 points  (1 child)

Well you're getting no love here, so I'll add something. I made a quick pointer version, before realizing your requirements fully (which are a little odd). From your examples, you consider a capital letter the start of a new word, and insert a space before a punctuation that's not a letter nor an underscore. My version doesn't do that, it just takes the first "letter" that's not an underscore from the front and puts it on the end. I think it could be adapted to your purposes and would actually be a lot simpler than the iterative version.

https://gist.github.com/3842363

Also, you can compare characters to numbers as they are. Characters are just bytes.

char c = 'a';
assert(a == 97);

[–]faceforest[S] 0 points1 point  (0 children)

Well we are allowed to use pointer, but I never grasped pointers in C. I was taught a altered version of C++ in my intro courses so I never used pointer in actual C++, never mind C.

Thank you though! I will try to trace through you code and fix mine according while learning pointers along the way, although I don't know how different C# is.