Computer Science Canada Sorting Arrays in Alphabetical Order, capitals and lowercase |
Author: | reymalile [ Thu May 19, 2011 8:40 am ] | ||
Post subject: | Sorting Arrays in Alphabetical Order, capitals and lowercase | ||
What is it you are trying to achieve? I am trying to sort arrays in alphabetical order What is the problem you are having? When I am sorting capital and lowercases, i change the capitals into a lowercase, sort them but then I cant change the capitals I changed to lowercase, back to capital. Describe what you have tried to solve this problem I tried using two arrays however theres a problem when sorting Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <Answer Here>
Please specify what version of Turing you are using 4.1.1 |
Author: | Tony [ Thu May 19, 2011 11:01 am ] | ||
Post subject: | RE:Sorting Arrays in Alphabetical Order, capitals and lowercase | ||
Str.Upper does the opposite of Str.Lower, but... since both "abc" and "Abc" both look like "abc" when you lower the first character, you wouldn't know how to restore the word without additional information. Since you are trying to implement a custom definition of a sort, perhaps the build-in
is not the right way to go (since the comparison operators such as > are already defined as something else). |
Author: | Insectoid [ Thu May 19, 2011 12:00 pm ] | ||
Post subject: | RE:Sorting Arrays in Alphabetical Order, capitals and lowercase | ||
You don't actually need to store lower-case values of upper-case characters. Since str.lower returns a value and doesn't actually change the parameter, you can use it in a condition.
|
Author: | reymalile [ Fri May 20, 2011 8:07 am ] |
Post subject: | RE:Sorting Arrays in Alphabetical Order, capitals and lowercase |
thanks insectoid, your code worked |