Re: Sorting Question for Marshall Barton (Cont'd)

Tech-Archive recommends: Fix windows errors by optimizing your registry



Marsh,

I tried to do a better explanation based on your last message, but
apparently did not succeed. I probably just don't know how to put my ideas
into the correct programming terms or rules.

I am also confused on how to deal with and make one rule for strings that
begin with numbers and strings that begin with characters. I am thinking
we have to look at both major types of strings, but could be wrong.

I deal with two major types of part number strings:

One type is either all digits from 1 to 12 digits, or it is 1 to 12 digits
with non-numeric characters in the string and may have non-numeric
characters at the end.

So, in this case would you check to see if there is any non-numeric
characters. If not, pad to 8 digits and sort. This would take care of
pure numeric strings. If the string has non-numeric characters in the
string, go to the first non-numeric character, and pad the left to cover
say 5 digits? You could then allow for 8 digits in the middle after the
left non-numeric character and sort. The right would be any non-numeric
character after the numeric string in the middle.

The other string type begins with from one to four alpha characters, can
have as many as 8 digits following the characters, and may have some
non-numeric characters at the end.

So, in this case the left would be up to 4 characters, the middle would be
up to eight numeric digits, and the right would be any non-numeric
character to the right of the mid?

Again, my terminology probably leaves a lot to be desired.

Does this make any sense?

Thanks

Tom


On Wed, 05 Sep 2007 12:14:41 -0500, Marshall Barton
<marshbarton@xxxxxxxxxx> wrote:

I think your first rule is inconsistent/ambiguous.

How can you determine the difference between the left,
middle and right portions of a part number like 1X2? It
seems to me that it could be either
L M R
1X 2
or
1 X2

You need to specify a set of rules that can be used to
separate the left, middle and right portions for every
possible part number. Without more definitive rules, I
don't see how we can write code to figure it out for you.

The fundamental concept that I was suggesting is to first
separate the portions (using code that implements your
rules) and then put them back together in a canonical form
that will sort the way you want.
--
Tom

.



Relevant Pages

  • Re: Sorting Question for Marshall Barton (Contd)
    ... length, leading or trailing digits, or nondigit characters. ... middle and right portions should be. ... begin with numbers and strings that begin with characters. ... If the string has non-numeric characters in the ...
    (microsoft.public.access.reports)
  • Re: Fibonacci numbers
    ... | Of course there is the question of how to store the number. ... Instead of using characters to represent decimal digits, ... It is easier than dealing with characters, as you don't need to offset ... the way that we write numbers in strings. ...
    (comp.lang.cpp)
  • Re: Best way to check if string is an integer?
    ... lot of strings? ... Return True if all characters in S are digits ...
    (comp.lang.python)
  • Re: extracting numbers and adding
    ... This was published in a prior post - it works on strings up to 99 ... characters and numbers up to 10 digits by extracting numeric portions ...
    (microsoft.public.excel)
  • Re: Why R6RS is controversial
    ... the semantics of the language, ... behavior of grapheme-cluster characters under most linguistic ... as the strings grow longer. ... Normalization is hideously complicated, and may require many ...
    (comp.lang.scheme)