How do I sort a TStringList without it changing the case?

Go down

How do I sort a TStringList without it changing the case?

· #1

I have a TStringList of names and I want them sorted alphabetically, ignoring upper and lower case. Sort puts all the capital letters first. Is there a setting?

Re: How do I sort a TStringList without it changing the case?

· #2

i have a similar issue. my printer is out of magenta but it wont print black and white either. is this a stringlist thing

Re: How do I sort a TStringList without it changing the case?

· #3

I... don't think that's a similar issue?

Re: How do I sort a TStringList without it changing the case?

· #4

its similar because it also doesnt work

Re: How do I sort a TStringList without it changing the case?

· #5

Answering the question that was asked:

pascal
Names.CaseSensitive := False;
Names.Sort;

CaseSensitive controls how the list compares strings, both for Sort and for IndexOf. If you want the list to stay sorted as you add to it, set Names.Sorted := True instead of calling Sort yourself.

For anything fancier, pass your own comparison to CustomSort.

Re: How do I sort a TStringList without it changing the case?

· #6

ok but what about the magenta

Re: How do I sort a TStringList without it changing the case?

· #7

The printer wants magenta to print black because the printer is a hostage situation with a paper tray. It has nothing to do with TStringList, and I say that as someone who would love to blame TStringList for something.

Re: How do I sort a TStringList without it changing the case?

· #8

CaseSensitive := False did it. Thank you, Lena. Sorry about the printer, Yolo.

Re: How do I sort a TStringList without it changing the case?

· #9

One topic, one problem. demo_yolo, your printer has been moved to its own topic in Off topic, next to the other printer. They can keep each other company.

Forum rules 1 to 10 apply. Yes, to you.

Go up

Sign in to reply