Obvious answer here: make a cleanup function (some replaces with case
insensitive regexps), and compare cleanup(string1) == cleanup(string2).
Something like (pseudocode):
function cleanup(input:string):string
{
var result:string=input;
replace [áàäãâ] in result with a (case insensitive, /gi in regexp);
replace [éèëê] in result with e (case insensitive, /gi in regexp);
......
replace ç in result with c (case insensitive, /gi in regexp);
replace ñ in result with n (case insensitive, /gi in regexp);
return result;
}
Not the most elegant solution, but it works and not too many lines of code
:)
On Fri, Feb 21, 2014 at 3:32 PM, João Fernandes <
[email protected]> wrote:
> Hi, I don't want to sort, sort will compare both strings and will return
> -1,0,1 for a sort order. What I pretend is as an example, find a proper
> match in the word "Computação", if I look for "tacão", "taçao" or "tacao".
> Case insensitivity is easily fixed by lowering both values but accent is
> not so trivial.
>
> The Flash native Collator
>
> http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/globalization/Collator.html
> Allow me to configure ignoreCase and ignoreDiacritics which allows me to
> perform a case and accent insensitive sorting or equality but not find
> within.
>
>
> On 21 February 2014 14:23, simon gladman <[email protected]> wrote:
>
> > I think the SortingCollator is what you need:
> >
> >
> >
> http://help.adobe.com/en_US/flex/using/WS19f279b149e7481c-1c03f02c12bd00c4763-8000.html
> >
> > Simon
> >
> >
> > On 21 February 2014 14:21, João Fernandes <
> > [email protected]> wrote:
> >
> > > Hi there, does anyone know if it's possible to find if a substring is
> > > contained in a string but performing an accent insensitive search?
> > >
> > > I tried using the flash native collator but it only supports equals() .
> > >
> > > Regards
> > > --
> > >
> > > João Fernandes
> > >
> >
> >
> >
> > --
> > *flexmonkey.co.uk <http://flexmonkey.co.uk> | @FlexMonkey
> > <https://twitter.com/FlexMonkey> | +44 (0) 7973 669691*
> >
>
>
>
> --
>
> João Fernandes
>