Print

Print


Ray,

This code was very easy to integrate!  I will do some testing and let you
know how well the regular expression works for us locally.

Many thanks!

Terry

On Fri, Oct 7, 2016 at 2:49 PM, Ray Voelker <[log in to unmask]> wrote:

> Hey Terry,
>
> I do indeed have one!
>
> https://github.com/rayvoelker/js-loc-callnumbers
>
> I probably should add some better documentation for this thing, but if you
> include that source, you should be able to do things like this ...
>
> //instantiate the call number class
> var loc = new locCallClass();
>
> // unsorted list of call numbers
> var range_data = ["HB 74 .M3 A4 1963", "H 1 .E77", "HB 74 .M3 A38"];
>
> //sort the range
> range_data.sort(function (a,b) {
> return loc.localeCompare(a,b);
> });
> //
>
> If you're looking to store the "normalized" versions of the call numbers
> (they're not very pretty to look at) in a spreadsheet, you could use the
> method "returnNormLcCall()" ...
>
> loc.returnNormLcCall('DA86 .R52');
>
> "DA0000000.000000086.000000000.R00000000.520000000.
> 000000000.000000000.000000000"
>
> loc.returnNormLcCall('DA506.A2 A4');
>
> "DA0000000.000000506.000000000.A00000000.200000000.
> A00000000.400000000.000000000"
>
> Let me know if you have any questions about it!
>
> --Ray
>
> On Fri, Oct 7, 2016 at 2:16 PM, Terry Brady <[log in to unmask]>
> wrote:
>
> > I need a JavaScript function that can normalize an LC Call Number for
> > sorting.
> >
> > I did a quick search of the list, and I saw some Perl and Python
> examples.
> > Before I attempt to port one of those versions to JavaScript, are you
> aware
> > of any JavaScript versions that already exist?
> >
> > Thanks, Terry
> >
> > --
> > Terry Brady
> > Applications Programmer Analyst
> > Georgetown University Library Information Technology
> > http://georgetown-university-libraries.github.io/
> > <https://www.library.georgetown.edu/lit/code>
> > 425-298-5498 (Seattle, WA)
> >
>
>
>
> --
> Ray Voelker
> (937) 229-1407
> Roesch Library
> University of Dayton
> 300 College Park
> Dayton OH, 45469-1360
>



-- 
Terry Brady
Applications Programmer Analyst
Georgetown University Library Information Technology
http://georgetown-university-libraries.github.io/
<https://www.library.georgetown.edu/lit/code>
425-298-5498 (Seattle, WA)