Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accents in comparision

Status
Not open for further replies.

curiousvbnet

Programmer
Apr 6, 2007
40
FR
Hi,

i have created a sub of search in a listview but in this sub i need to compar elements, it means : the text a user writes in a text box and the label of listview item( listview items' array if it is exact)
To make this comparision more precise [blue]i need not to consider accents because in french language , people use accents.[/blue]

How can i get off this problem concerning these accents
[blue]è, é,ê,ë ( it can bel any letter instead of 'e') [/blue]
I thought that if i ask the textbox.text to be transformed to Upper case it will remove the accents automatically but it is not the case at all

Here is the condition i need to arrange


Code:
If Replace(TextBox1.Text.ToUpper.TrimEnd, "'", "''") = ListView1.Items(iItemIndex).Text.Substring(0, TextBox1.Text.TrimEnd.Length).ToUpper Then

Thanks a lot for your help

Regards.
Nathalie

 
look at [tt]Imports System.Globalization[/tt] and the overload of [tt]string.Compare[/tt] that uses [tt]CultureInfo.CurrentCulture[/tt].




mr s. <;)

 
Hi,

This method permits to compare two string ignoring or respecting their case, but not ignoring their accents.

Perhaas you could tell more about your proposition.
Regards.
Nathalie

 
use a CompareInfo object and the CompareOptions.IgnoreNonSpace option:

Code:
Dim comparer as CompareInfo
comparer = CompareInfo.GetCompareInfo(CultureInfo.CurrentCulture.Name) ' "fr-FR"?
If comparer.Compare("a", "à", CompareOptions.IgnoreNonSpace) = 0 Then
  ' do stuff
End If


mr s. <;)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top