I've got an IEnumerable<string>
with values like:
- pp
- pp.10.0
- pp.6.0
- pp.6.1
- pp.8.3
- kp.10.1
- kp
- kp.3.20
... etc
I'd like to organize them alphabetically, but keeping the values with double digits (in example above ones with 10.0 and 10.1) below the ones with single digits. In other words, after sorting it should look like this:
- kp
- kp.3.20
- kp.10.1
- pp
- pp.6.0
- pp.6.1
- pp.8.3
- pp.10.0
I tried a simple IEnumerable<string>.OrderBy(x => x, StringComparer.CurrentCultureIgnoreCase)
but that doesn't quite work in this case.
Also bear in mind that the pp
and kp
parts could have dots in them as well, if you're thinking of splitting the string.