Clean up sorting functions for mixed text and numbers

Bug #1752298 reported by Simon Richter
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KiCad
Expired
Low

Bug Description

This is a possible task for beginners.

There are several implementations of sorting functions for mixed text/number strings that split the string and sort number parts numerically, i.e. "A1", "A2", "A10", "B1", ...

It would be nice to unify these into a single utility function. This function should have an option to switch to the ordering for BGA pad numbers, where "AA" sorts behind "B".

Some existing implementations:

eeschema/fields_editor_table_model.cpp
eeschema/pin_number.cpp

I'm sure there are some others.

Tags: starter
Revision history for this message
Simon Richter (sjr) wrote :

Also, "RefDesStringCompare" in common/strings.cpp

tags: added: starter
Revision history for this message
Jeff Young (jeyjey) wrote :

eeschema/fields_editor_table_model.cpp is now gone.

However, there's a new ValueStringCompare in common/strings.cpp with one unimplemented feature:

it handles numbers with modifiers and/or units, but not numbers with modifiers where the decimal goes (ie: 1K2).

Revision history for this message
Simon Richter (sjr) wrote :

You will be delighted to hear that eeschema/pin_number.cpp does that for volts, to support pin names specifying voltages.

This is fairly obscure though, as it is only relevant for negative voltages, where we want "-12V5" to sort before "-12V".

I shall now go and flog myself for actually implementing that.

Jeff Young (jeyjey)
Changed in kicad:
status: New → Triaged
importance: Undecided → Low
Changed in kicad:
assignee: nobody → Pradeepa Senanayake (pradeepas)
Revision history for this message
Evan Shultz (evan-shultz) wrote :

FYI, you may find http://www.davekoelle.com/alphanum.html useful if it's not known already.

Here is a list which may help, which includes a combination of potential net names and ref des and pin "numbers":
("!NOT" "*UP" "+15V" "+15V_A" "+15V_B" "-15V" "-15V_A" "-15V_B" "0V" "5V" "A1" "A1A" "A2" "A10" "AA2" "AA10" "AW12" "B3" "B20")

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

KiCad bug tracker has moved to Gitlab. This report is now available here: https://gitlab.com/kicad/code/kicad/-/issues/1846

Changed in kicad:
status: Triaged → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.