Le 04/12/2016 à 13:46, Michael Steinberg a écrit : > > Am 04.12.2016 um 13:33 schrieb jp charras: >> It is similar to a string comparison (for string sorting) but unlike the >> usual strncmp() or >> strncasecmp() functions, when digits are encountered in a string, they are >> converted to a number and >> this is the number value which is taken in account for comparison. >> >> This is especially useful to sort component references or value. >> For instance: >> when the 2 strings U12 and U2 are compared by ASCII value: >> In usual comparison (from ASCII value), U120 is sorted before U20 >> In StrNumCmp: >> 120 is read as a integer value >> 20 is read as a integer value >> and comparisons are between U<120> and U<20> where <120> and <20> are >> integers, not chars. >> >> and U120 is sorted after U20 > > Hello Jean-Pierre, > > thank you for the information. > So a numeric character range is to be treated as one character position whose > value its the parsed > number, right?
Right. > Is the aLength parameter designed to mean raw character counts, or > character/number positions? Would > "U12" compare smaller to "U2" at aLength == 2? Please consider aLength as the count of characters to take in account. (I mean "U12" compare to "U2" at aLength == 2 compare "U1" and "U2") > Cases like "U12A4A3" vs. "U12A4A4" are also specified where the latter would > compare "greater", yes? > > Michael Yes, although is is a corner case, but it can happens. -- Jean-Pierre CHARRAS _______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

