Questions tagged [natural-sort]
Natural sorting is ordering things the way a human would. So for example, "a2" comes before "a10" even though a simple minded character-by-character comparison would put "a10" before "a2". Natural sorting is especially useful for IP addresses and version numbers.
natural-sort
261
questions
4
votes
2
answers
93
views
How can i select files using powershell? [duplicate]
I have files
Test1.zip
Test2.zip
Test3.zip
Test10.zip
Test11.zip
When i do a select in powershell using this command
Get-ChildItem -Path "c:\temp" -Filter "*.zip" | Sort-Object
...
0
votes
1
answer
119
views
Sorting alphanumeric string in Kotlin (numeric, not lexicographical order)
I was trying to sort this list
val list = mutableListOf("1", "2", "10", "A10", "A1", "A2","B24C","A")
list.sort()
...
-1
votes
1
answer
53
views
Sort list of dictionaries based on relative time
I have a CSV file that I create from an API response. I get it unsorted and the API response does not have a query parameter to sort the returned payload. The CSV looks like below, where column A has ...
0
votes
2
answers
109
views
Ordering by attribute that contains letters and numbers
We need to order a list of room numbers. You can think of the units being numerically ordered, with the possibility of a letter in front as a prefix, e.g 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, A1, A2, A3, A4, ...
0
votes
2
answers
199
views
Natural Sorting in Java [closed]
Just a heads up: This is maybe not as much of a 'help me program' question, but more of an 'is this a bug or just not clearly defined behaviour'.
Let's take the following list of strings:
item01mark2, ...
-1
votes
2
answers
87
views
Natural sort of alphanumerical strings in JavaScript (excluding hexadecimal)
I'm looking for an efficient way to sort a list of Alphanumeric labels but ignoring to sort the hexadecimal values like below.
arr = [
"a_19",
"a_2",
"b_645500",
&...
-1
votes
1
answer
32
views
MySQL - search and natural sorting [duplicate]
I have a stock of items. For example, item number (and value in the data base) is C10364A. The item has a barcode on it. When I scan it with a barcode scanner, the code value is PC10364A.
I would like ...
0
votes
2
answers
55
views
How does SQL define "alphabetical order", precisely?
Most algorithms for alphabetical order give similar results, but there are a few edge cases, three are mentioned in this article.
For example:
Newspapers
News photography
Newsprint
Is that correct ...
0
votes
2
answers
227
views
How to get highest alphanumeric value in Postgres
I have the following table of inventory stock symbols and want to fetch the highest alphanumeric value which is AR-JS-20. When I say "highest" I mean that the letter order is sorted first ...
0
votes
1
answer
72
views
Effective Java 3: item 31: using <? extends T> for producers, is not applicable for different data structures
This code from the Item 31:
public class Union {
public static <E> Set<E> union(Set<? extends E> s1, Set<? extends E> s2) {
// Bloch used HashSet, but I want ...
1
vote
2
answers
789
views
Postgresql natural sort with numbers first
In Postgres I need to sort text with natural order, but with one exception - if the string has only number, it should be placed at top.
So I need such order:
["98", "125", "...
2
votes
3
answers
377
views
How do you do natural ordering for strings with negative numbers and characters?
I have a list of file names that I need to open, however, the file names contain a hyphen "-" which neither os or Windows 10 naturally recognizes as a negative number. As an example, the ...
1
vote
2
answers
54
views
Filter out time values in a flat array if less than current time
I have a variable that stores current time with $current_time and another variable with an array of time stored in $time_slot I am looking for a way around to unset from array variable $time_slot all ...
0
votes
1
answer
345
views
Natural sorting of UTF-8 strings in DynamoDB
I'm storing file names (with extension) and directory names as UTF-8 strings in DynamoDB as sort keys.
As far as I know, file names + ext and directory names are unique within a directory, so I can ...
0
votes
0
answers
96
views
Python: Using binary search to perform natural sorting
I am using a binary search to insert into a sorted list of lists. The code below works fine for an alphanumeric sort but I cannot figure out how to make the sort work in a natural sorting order.
The ...