[Gambas-user] Problem of searching string

Benoît Minisini gambas at ...1...
Thu Oct 25 21:04:19 CEST 2012


Le 21/10/2012 02:10, Mohamed Hajjaj a écrit :
> Dear Mr. Benoit,
>
> Thank you for your prompt reply.
>
> I will try to explain my problem as you suggest through example(but I
> have to attach small Arabic file to you to see the problem because it is
> not appear with Latin letters.
>
> what is the problem:
>
> 1. when the Arabic letters have diacritics (in the text file which we
> will search inside it) and write a
>      word through keyboard (without diacritics) which already exists in
> the file , the result from
>      "String.inStr" will return "0" and message come the word not found.
>      This problem not exists when I search arabic file without diacritics .

I guess that this is the same problem as with french: letters with 
diacritics are different characters than letters without diacritics.

So you have to write a routine that replace all letters with diacritics 
by their equivalent without diacritics, and apply that routine to the 
two strings before calling String.InStr().

I have done such a routine for my own needs in french. But I can't help 
you for arabic. See [1], maybe it can help.you

> 2.If the word is found how I can change background colour of the word
> searched inside textarea?

You cannot do that in a TextArea widget. You must use the gb.qt4.ext 
TextEdit or Editor control.

[1] http://en.wikipedia.org/wiki/Arabic_script_in_Unicode

-- 
Benoît Minisini




More information about the User mailing list