Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

sort strings by length and by alphabet

bool comp(string a, string b) {
	if (a.size() != b.size()) return a.size() < b.size(); // primarily by length
	return a < b;  //secondarily by alphabetical
}
 
PREVIOUS NEXT
Tagged: #sort #strings #length #alphabet
ADD COMMENT
Topic
Name
3+7 =