Jump to content

StringInStr Functionality


 Share

Recommended Posts

The name to match is always going to be unique it can be all alpha, alpha numeric or numeric.

This code works fine:

$sNameToMatch = "smith"

$pNameToMatch = "jones smith brown green white black"

$NameMatched = StringInStr($sNametoMatch, $pNameToMatch)

Where the variable you want to match is a numeric [like a phone number] it does not work

$sNameToMatch = "61390902657"

$pNameToMatch = "jones smith brown 61390902657 white black"

$NameMatched = StringInStr($sNametoMatch, $pNameToMatch)

Is this a simple case of converting the number to text [for example - a61390902657] or is it achieved in some other way?

Help is always appreciated.. Ant.. ;)

Link to comment
Share on other sites

Sorry I got it the wrong way round with the variables

$pNameToMatch [Process name to match] = 'smith'

$sNameToMatch [string containing name to match] "jones smith brown green white black"

In which case this code is correct

$NameMatched = StringInStr($sNametoMatch, $pNameToMatch)

Result should be 7

Are you saying that

$pNameToMatch [Process name to match] = '123456'

$sNameToMatch [string containing name to match] "jones 123456 brown green white black"

$NameMatched = StringInStr($sNametoMatch, $pNameToMatch)

will produce the the same result 7?

Ant.. ;)

Link to comment
Share on other sites

  • Moderators

Sorry I got it the wrong way round with the variables

$pNameToMatch [Process name to match] = 'smith'

$sNameToMatch [string containing name to match] "jones smith brown green white black"

In which case this code is correct

$NameMatched = StringInStr($sNametoMatch, $pNameToMatch)

Result should be 7

Are you saying that

$pNameToMatch [Process name to match] = '123456'

$sNameToMatch [string containing name to match] "jones 123456 brown green white black"

$NameMatched = StringInStr($sNametoMatch, $pNameToMatch)

will produce the the same result 7?

Ant.. ;)

Well... yes it does ...

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...