String Compare first 6 characters

  • Thread starter Thread starter gerards_
  • Start date Start date
G

gerards_

Hi all,

What I am trying to do is to String Compare just the first 6 characters
of a string.

For example:

For the compare string "Powama" I want to return true for any strings
that contains these first 6 characters (in order).

So for the following strings the result should be:

Powamaster.exe ---> True
Powama~2.exe -----> True
Powama~11.exe-----> True
notepad.exe ------> False

etc...

It would also be great if it wasn't case sensitive.

I am using this code right now but it compares the whole word:

StrComp(CompareLogProcess, CompareTskProcess, 1) = 0

Any help greatly appreciated (please email me directly or post)
Thanks

Powerguy
 
Powerguy

Do you mean.
\\\
if mystring.substring(0,6) = "powama" then
///
I hope this helps

Cor
 
What I am trying to do is to String Compare just the first 6 characters
of a string.

For example:

For the compare string "Powama" I want to return true for any strings
that contains these first 6 characters (in order).

So for the following strings the result should be:

Powamaster.exe ---> True
Powama~2.exe -----> True
Powama~11.exe-----> True
notepad.exe ------> False

etc...

It would also be great if it wasn't case sensitive.


If 'Option Compare Text' is used (this is the default), comparing using the
'=' operator would not be case sensitive:

\\\
If Left(FileName, 6) = "Powama" Then
...
End If
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top