> why i do for detect one string in a other string
> example > j want find "toto" in an other string > if is good i do then > if is not good else
> instr ? but i have bad response and it's no good
> help please > thank
What you call a "chain" is called a "string" in English. I recommend that you download the helpfile script56.chm from the Microsoft site. It gives you a detailed explanation of the "instr" function, including a specific example. If this does not suffice then you should post the code that does not work for you.
> why i do for detect one string in a other string
> example > j want find "toto" in an other string > if is good i do then > if is not good else
> instr ? but i have bad response and it's no good
> help please > thank
Here's a simple example I threw together, how to use regular expressions to find all occurrences of a string inside another string:
'########################################### Set find = CreateObject("VBScript.RegExp") With find .Global = True .IgnoreCase = True .Pattern = "toto" End With testData = "-toto-Toto-tOto-toTo-totO-TOTO-" Set finds = Find.Execute(testData) For Each pos in finds WScript.Echo pos.Value & " " & pos.FirstIndex Next Set finds = Nothing Set find = Nothing '###########################################
>> why i do for detect one string in a other string
>> example >> j want find "toto" in an other string >> if is good i do then >> if is not good else
>> instr ? but i have bad response and it's no good
>> help please >> thank
> What you call a "chain" is called a "string" in English. I recommend that > you download the helpfile script56.chm from the Microsoft site. It gives > you a detailed explanation of the "instr" function, including a specific > example. If this does not suffice then you should post the code that does > not work for you.
Another useful bit of advise to the OP would be to suggest he include a copy of the script that is giving a "bad response" so we would have a hope in heck of being able to point out where he might have gone wrong.
>>> why i do for detect one string in a other string
>>> example >>> j want find "toto" in an other string >>> if is good i do then >>> if is not good else
>>> instr ? but i have bad response and it's no good
>>> help please >>> thank
>> What you call a "chain" is called a "string" in English. I recommend that >> you download the helpfile script56.chm from the Microsoft site. It gives >> you a detailed explanation of the "instr" function, including a specific >> example. If this does not suffice then you should post the code that does >> not work for you.
> Another useful bit of advise to the OP would be to suggest he include a > copy of the script that is giving a "bad response" so we would have a hope > in heck of being able to point out where he might have gone wrong.
> /Al
Mmh. Isn't this what I suggested in my last sentence?
my script (bad, and j don't understand) fullname is a fic name ______________________________________________________ set fso_sansaccent_exeptions = fso.OpenTextFile(fichier_exeptions) while Not fso_sansaccent_exeptions.AtEndOfStream exeption = fso_sansaccent_exeptions.ReadLine
if instr(fullname, exeption) <> 0 then wscript.echo fullname & " : EXEPTION, pas de traitement !!!!!!!!!" else wscript.echo fullname & " : traitement !!!!!!!!!"
> my script (bad, and j don't understand) > fullname is a fic name > ______________________________________________________ > set fso_sansaccent_exeptions = fso.OpenTextFile(fichier_exeptions) > while Not fso_sansaccent_exeptions.AtEndOfStream > exeption = fso_sansaccent_exeptions.ReadLine
> if instr(fullname, exeption) <> 0 then > wscript.echo fullname & " : EXEPTION, pas de traitement !!!!!!!!!" > else > wscript.echo fullname & " : traitement !!!!!!!!!"
I can't entirely follow the logic in your script but I note two problems: - You reversed the position of the two arguments in your "instr"-function. - You performed a binary rather than an ASCII comparison. Try this modified script:
fichier_exeptions = "d:\test.txt" sFullName = "c:\boot.ini" Set oFSO = CreateObject("Scripting.FileSystemObject") Set ofso_sansaccent_exeptions = oFSO.OpenTextFile(fichier_exeptions) While Not ofso_sansaccent_exeptions.AtEndOfStream sLine = ofso_sansaccent_exeptions.ReadLine If InStr(1, sLine, sFullName, 1) > 0 Then WScript.echo sLine & " : EXEPTION, pas de traitement !!!!!!!!!" Else WScript.echo sLine & " : traitement !!!!!!!!!" End If Wend
>>>> why i do for detect one string in a other string
>>>> example >>>> j want find "toto" in an other string >>>> if is good i do then >>>> if is not good else
>>>> instr ? but i have bad response and it's no good
>>>> help please >>>> thank
>>> What you call a "chain" is called a "string" in English. I recommend >>> that you download the helpfile script56.chm from the Microsoft site. It >>> gives you a detailed explanation of the "instr" function, including a >>> specific example. If this does not suffice then you should post the code >>> that does not work for you.
>> Another useful bit of advise to the OP would be to suggest he include a >> copy of the script that is giving a "bad response" so we would have a >> hope in heck of being able to point out where he might have gone wrong.
>> /Al
> Mmh. Isn't this what I suggested in my last sentence?
Memo to self: try to remember to read more closely before responding. My apologies.
> "karamel" <kara...@yahoo.fr> wrote in message > news:4af1b5b6$0$965$ba4acef3@news.orange.fr... >> my script (bad, and j don't understand) >> fullname is a fic name >> ______________________________________________________ >> set fso_sansaccent_exeptions = fso.OpenTextFile(fichier_exeptions) >> while Not fso_sansaccent_exeptions.AtEndOfStream >> exeption = fso_sansaccent_exeptions.ReadLine
>> if instr(fullname, exeption) <> 0 then >> wscript.echo fullname & " : EXEPTION, pas de traitement !!!!!!!!!" >> else >> wscript.echo fullname & " : traitement !!!!!!!!!"
> I can't entirely follow the logic in your script but I note two problems: > - You reversed the position of the two arguments in your "instr"-function. > - You performed a binary rather than an ASCII comparison. > Try this modified script:
> fichier_exeptions = "d:\test.txt" > sFullName = "c:\boot.ini" > Set oFSO = CreateObject("Scripting.FileSystemObject") > Set ofso_sansaccent_exeptions = oFSO.OpenTextFile(fichier_exeptions) > While Not ofso_sansaccent_exeptions.AtEndOfStream > sLine = ofso_sansaccent_exeptions.ReadLine > If InStr(1, sLine, sFullName, 1) > 0 Then > WScript.echo sLine & " : EXEPTION, pas de traitement !!!!!!!!!" > Else > WScript.echo sLine & " : traitement !!!!!!!!!" > End If > Wend