Sort string

Hello, how to sort strings?
I know how to sort string arrays, but how to sort one string lenght to another?
Here,s function how I sort strings arrays
1
2
3
4
5
6
7
8
9
void AnalyzeLine(string & eil, string & skyr, int & ind, string zodziai[], int & in){
	string zodis;
	int zpr = 0, zpb = 0, i = 0;
	while ((zpr = eil.find_first_not_of(skyr, zpb)) != string::npos){
		zpb = eil.find_first_of(skyr, zpr);
		zodis = eil.substr(zpr, zpb - zpr);
	 }
	Sort(zodziai, in);
}

1
2
3
4
5
6
7
8
9
10
11
12
void Sort(string mas[], int in){
	string s;
	for(int i = 0; i < in - 1; i++){
		for(int j = in; j > i; j--){
			if(mas[i].length() < mas[j].length()) {
				s = mas[i];
				mas[i] = mas[j];
				mas[j]  = s;
			}
		}
	}
}
Last edited on
Why are you looking at string lengths? I thought you were sorting strings?

Are you sorting the strings by length?

Yes, I'm sorting strings my length
Topic archived. No new replies allowed.