flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From João Fernandes <joaopedromartinsfernan...@gmail.com>
Subject Re: Accent insensitive search
Date Fri, 21 Feb 2014 18:23:09 GMT
The problem is, that solution works ok for latin languages but the
replacement table is way bigger than that. For example in german, SS and ß
should be the same and I'm pretty sure there are dozens of other items in
this list. My question is, isn't there any other solution, eventually any
existing library that supports this without the hackish solution?

BTW, I've raised a bug in the public bugbase
https://bugbase.adobe.com/index.cfm?event=bug&id=3711838 but I'm not
holding my breath.


On 21 February 2014 18:11, Javier Guerrero García <javi.gg@gmail.com> wrote:

> 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 <
> joaopedromartinsfernandes@gmail.com> 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 <sgladman@gmail.com> 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 <
> > > joaopedromartinsfernandes@gmail.com> 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
> >
>



-- 

João Fernandes

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message