Sort strings in alphabetical order 
Author Message
 Sort strings in alphabetical order

Hello,

I have a script that writes words to a text file. How do I make it such that
the words written to the file are in alphabetical order?

Thanks

Shirlyn



Sun, 06 Apr 2003 03:00:00 GMT  
 Sort strings in alphabetical order



Quote:
> Hello,

> I have a script that writes words to a text file. How do I make it such that
> the words written to the file are in alphabetical order?

Are the words in an array? How are they stored?

-Chad



Sun, 06 Apr 2003 03:00:00 GMT  
 Sort strings in alphabetical order
The words are not in an array....Actually 4 letters are given to the script
n it jumbles them up into words. All possible combinations are then written
to a file.


Quote:



> > Hello,

> > I have a script that writes words to a text file. How do I make it such
that
> > the words written to the file are in alphabetical order?

> Are the words in an array? How are they stored?

> -Chad



Sun, 06 Apr 2003 03:00:00 GMT  
 Sort strings in alphabetical order



Quote:
> The words are not in an array....Actually 4 letters are given to the script
> n it jumbles them up into words. All possible combinations are then written
> to a file.

Well, you have to be storing the letters and the words SOMEWHERE... don't you?
Or are you just writing them out to the file as you determine them?

If you wish to sort them, you have to put them into a collection, dictionary or
array first before commiting them to the file.

-Chad

Quote:





> > > Hello,

> > > I have a script that writes words to a text file. How do I make it such
> that
> > > the words written to the file are in alphabetical order?

> > Are the words in an array? How are they stored?

> > -Chad



Sun, 06 Apr 2003 03:00:00 GMT  
 Sort strings in alphabetical order
Chad is correct, and provides probably the simplest answer. The other option
is to make sure your code generates the words in alphabetical order. To do
this, re-structure your code so that the four letters are used in
alphabetical order, then make the last letter in the generated word the one
that varies most often, and generate all words starting with a particular
letter before going on to the next one. I.e. input letters Z, A, X, M, sort
as A, M, X, Z, then let your code do the generation:

A
AA
AM
AX
AZ
AAA
AAM
AAX
AAZ
AMA
<etc>
AZZZZZ
M
MA
MM
<etc>


Quote:



> > The words are not in an array....Actually 4 letters are given to the
script
> > n it jumbles them up into words. All possible combinations are then
written
> > to a file.

> Well, you have to be storing the letters and the words SOMEWHERE... don't
you?
> Or are you just writing them out to the file as you determine them?

> If you wish to sort them, you have to put them into a collection,
dictionary or
> array first before commiting them to the file.

> -Chad





> > > > Hello,

> > > > I have a script that writes words to a text file. How do I make it
such
> > that
> > > > the words written to the file are in alphabetical order?

> > > Are the words in an array? How are they stored?

> > > -Chad



Sun, 06 Apr 2003 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. sorting array values in alphabetical order

2. Sort order - Edit Filter Sort or Quick Sort

3. GS 7.00 Win with devicenames in alphabetical order!

4. Get files in alphabetical order

5. Alphabetical Order

6. Alphabetical order

7. EnumNetworkDrives in alphabetical order

8. Sorting strings in ascending order

9. to cross a table in alphabetical order

10. Printing documents in alphabetical order

11. Print documents in alphabetical order

12. Print documents in alphabetical order

 

 
Powered by phpBB® Forum Software