This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
This is a post in response to This one about alphabetising a String. The code in the original post of this thread was modified, so now I'm commenting on the changes. I'm doing this rather than adding to the original thread because on the original thread code changes were made after comments were added. This makes the thread a little nonsensical. So, here goes:
Hi Kathy, The code you put up is really really close to working, so I'll go against my usual principle of not correcting code outright, and do just that. Here's your code with a few changes:
OK, so I made these changes: At 1, I did two things:. First, removed the extra parameter to showMessageDialog that wasn't needed (and would have caused a compilation error). Second, I replaced 'charArray' with 'sort(s)'. I hope it's clear why I did this - we have the sort method, and we want to print the result of sorting the String s. At 2 and 3, I changed 'string' to 's'. Your method sort takes a parameter of type String, whose name is 's'. So, when you want to access that parameter, you use the name 's'. One final point is that you could do this in an easier way. The body of your sort method could be replaced by the following:
Hope all this helps, if anything's unclear, post back. Cheers --Tim
PS I tried to send you a private message about this but it says you're not accepting them. Also, looks like no-one gets told when a post is modified. So I'm guessing it's best to re-post and give a reference (or even a link) to your previous post. [ April 21, 2004: Message edited by: Tim West ]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com