I am developing a program that uses string functions in VB and in general does it well BUT I have found a case that does not work as expected.

In the following code, the content of variable text_to_search exists inside of texto_base but always returns the variable exists = false.

The code is very simple:

existe = false
If texto_base.Contains(text_to_search) Then
    existe = True
End if

Theses variables contains:

text_to_search = "se vuelven nuestros compañeros"

texto_base = "los perros son parte de la familia. se vuelven nuestros compañeros y amigos fieles. se apropian de nuestro corazón, de nuestros pensamientos y... de nuestras camas"

Could it be that the variable texto_base contains special characters that are not visually visible? Or that has a different encoding?

Note: I have tried indexof and instr with same result.

0 Answers