Jump to content
Sign in to follow this  
anixon

StringInStr Functionality

Recommended Posts

anixon

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.. ;)

Share this post


Link to post
Share on other sites
Richard Robertson

What do you mean it doesn't work? That should work just fine. Are you sure the numeric formatting is the same?

Share this post


Link to post
Share on other sites
picaxe

I think you have strings wrong way arround. Try

$NameMatched = StringInStr($pNametoMatch, $sNameToMatch)

Share this post


Link to post
Share on other sites
anixon

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.. ;)

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
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
Sign in to follow this  

×