Changeset 385 for trunk/gsdl/perllib/classify/AZList.pm
- Timestamp:
- 1999-07-14T14:54:20+12:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/classify/AZList.pm
r360 r385 2 2 3 3 package AZList; 4 5 use sorttools; 4 6 5 7 sub new { … … 34 36 if (defined $metavalue && $metavalue =~ /\w/) { 35 37 if ($self->{'metaname'} eq 'Creator') { 36 $self->format_string_name_english (\$metavalue);38 &sorttools::format_string_name_english (\$metavalue); 37 39 } else { 38 $self->format_string_english (\$metavalue);40 &sorttools::format_string_english (\$metavalue); 39 41 } 40 42 if (defined $self->{'list'}->{$doc_OID}) { … … 201 203 } 202 204 203 # format an english name for sorting204 # i.e. convert to lowercase, put surname before205 # first names etc.206 sub format_string_name_english {207 my $self = shift (@_);208 my ($stringref) = @_;209 210 $$stringref =~ tr/A-Z/a-z/;211 $$stringref =~ s/[^a-z0-9 ]//g;212 $$stringref =~ s/\s+/ /g;213 $$stringref =~ s/^\s+//;214 my @names = split / /, $$stringref;215 my $surname = pop @names;216 while (scalar @names && $surname =~ /^(jnr|snr)$/i) {217 $surname = pop @names;218 }219 $$stringref = $surname . " " . $$stringref;220 }221 222 # format an english string for sorting223 # i.e. convert to lowercase, remove the, a or an224 # from beginning of string etc.225 sub format_string_english {226 my $self = shift (@_);227 my ($stringref) = @_;228 229 $$stringref =~ tr/A-Z/a-z/;230 $$stringref =~ s/[^a-z0-9 ]//g;231 $$stringref =~ s/^\s*(the|a|an)\b//;232 $$stringref =~ s/^\s+//;233 }234 235 205 1;
Note:
See TracChangeset
for help on using the changeset viewer.