TMTOWTDI - this is a more general solution that remaps characters in a string in a fairly (cough) efficient manner. You'd want to use this in conjunction with a Swartzian transform.
my @lowervec = ( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, ' ','!','"','#','$','%','&','\'','','','*','+','','','','', '0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?', '@','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o', 'p','q','r','s','t','u','v','w','x','y','z','[','\\',']','^','_', '`','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o', 'p','q','r','s','t','u','v','w','x','y','z','{','|','}','~',127, 'c','u','e','a','a','a','a','c','e','e','e','i','i','i','a','a', 'e',145,'','o','o','o','u','u','y','o','u',155,156,157,158,159, 'a','i','o','u','n','n',166,167,168,169,170,'',172,173,174,175, 176,177,178,179,180,181,182,183,184,185,186,'',188,189,190,191, 192,193,194,195,196,197,198,199,200,'e',202,203,204,205,206,207, 208,209,210,211,212,213,'o',215,216,217,218,219,220,221,222,223, 'a','a',226,227,'a',229,230,'c',232,'e',234,'e',236,'i',238,239, 240,241,242,'o','o',245,'o',247,248,249,250,251,'u','y',254,255, ); # Lowercases string, remaps accented chars and removes some non-alphab +etic chars sub cleanstring($) { return join('', map { $lowervec[ord($_)] } split('', shift)); }

-- Michael Snell
-- michael@snell.com


In reply to Re: Diacritic-Insensitive and Case-Insensitve Sorting by snellm
in thread Diacritic-Insensitive and Case-Insensitve Sorting by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.