Nuno Posted March 6, 2013 at 12:56 PM Report #498113 Posted March 6, 2013 at 12:56 PM boas na seguinte string queria verificar a existencia da palavra "aAVa" testei com if linha.contains("aAVa") mas nada feito. String: linha= %%ñ%l4aAVaTExto a retirar%K@0 óøóø%%%Ùñ%l,aAVaA TExto a retirar2%%%$ñ%l (aAVaA1%%%ñ%l,aAVaA 6,51%6²K@0 ×vî×vî%%×%l,aAVaTExto a retirar3%K@0 óøóøK@0 £×î£×î%%Ê×%l,aAVaAP.V.P.%K@0 óøóøK@0 ×5î×5î%%×%l(aAVaAUd%K@0 óøóøK@0 W×®îW×®î%%j×%l,aAVaAImporte%K@0 óøóø%%{%l(
ribeiro55 Posted March 6, 2013 at 01:22 PM Report #498118 Posted March 6, 2013 at 01:22 PM Estás a fazer alguma coisa errada, porque isso tem de funcionar. Dim linha As String = "%%ñ%l4aAVaTExto a retirar%K@0 óøóø%%%Ùñ%l,aAVaA TExto a retirar2%%%$ñ%l(aAVaA1%%%ñ%l,aAVaA 6,51%6²K@0 ×vî×vî%%×%l,aAVaTExto a retirar3%K@0 óøóøK@0£×î£×î%%Ê×%l,aAVaAP.V.P.%K@0 óøóøK@0 ×5î×5î%%×%l(aAVaAUd%K@0 óøóøK@0 W×®îW×®î%%j×%l,aAVaAImporte%K@0 óøóø%%{%l(" MsgBox(linha.Contains("aAVa")) Devolverá TRUE, que indica que existe Alternativamente podes testar se o índice de uma sub-string é diferente de -1 (ou seja, existe algures), assim: MsgBox(linha.IndexOf("aAVa") <> -1) Devolverá TRUE, que indica que existe. Sérgio Ribeiro "Great coders aren't born. They're compiled and released""Expert coders do not need a keyboard. They just throw magnets at the RAM chips"
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now