
-----------------------------------
cat8864
Thu Nov 20, 2008 1:58 pm

Sorting a string
-----------------------------------
I need to create a program that takes a string of user input and sorts according to vowel, consonant, number and other. I managed to get it to work partially. The vowels and consonants get sorted fine but anything else gets place with the consonants. Any attempt to modify it just results in one of many error messages that say the results are too long or something exceeds the boundaries.

Here's my program so far:

var word : string
const vowels := "aeiou"
const consonants := "bcdfghjklmnpqrstvwxyz"
const numbers := "1234567890"
const other := "~`!@#$%^&*()_+-={}

Mod Edit: Instead of color tags for code, use syntax tags. Thanks :) [syntax="Turing"]Code Here[/syntax]

-----------------------------------
The_Bean
Thu Nov 20, 2008 7:00 pm

Re: Sorting a string
-----------------------------------
Simply changing the =0 to >0 should do it.

-----------------------------------
cat8864
Fri Nov 21, 2008 1:01 pm

Re: Sorting a string
-----------------------------------
Thanks! But why '>' instead of '='? Is it because the length changes each time or something?

-----------------------------------
HellblazerX
Fri Nov 21, 2008 1:06 pm

RE:Sorting a string
-----------------------------------
Because index returns the position of the character.

-----------------------------------
cat8864
Fri Nov 21, 2008 1:39 pm

Re: Sorting a string
-----------------------------------
So because I had "= 0" it didn't read the rest of the if statement
