Strings

  • Thread starter Thread starter Daniel N
  • Start date Start date
D

Daniel N

Is there a way of setting the string Wildcard to true for multiple scenarios
such as;

Dim Wildcard As String

If Wildcard = "This" And Wildcard = "That" Then

'Do stuff here

End If
 
Daniel N said:
Is there a way of setting the string Wildcard to true for multiple
scenarios such as;

Dim Wildcard As String

If Wildcard = "This" And Wildcard = "That" Then

'Do stuff here

End If


I recommend to describe what you want to archieve in more detail because
it's unclear what you understand by the term "wildcard". The code inside
the 'If' block shown above will never be executed because if the value of
'Wildcard' is "This", it cannot be equal to "That".
 
Essentially I want a string to be able to define multiple instances. Similar
to using the (*) while doing a search. I posted this in dotnet.general:

hWnd = FindWindow("CLASS NAME", *)
A string must be where the (*) is. Is there a way of making some kind of
wildcard so that function accepts every string instance?

To which someone replied;I should use the EnumWindows API along with the
GetClassName API.

But , after googleing I found
:http://www.vbaccelerator.com/home/vb/code/Libraries/Windows/Enumerating_Windows/article.asp
But still have no idea what do.
 
Daniel,

This answer from you we have seen now twice, but it does probably for
nobody describe what you want to doe.

As Herfried already wrote (in another way) in an earlier message. A string
can contain any collection of characters,

A string is nothing more than an address in memory with a certain lenght. In
the positions of that it is possible to set that collection of charecters
(unicode) which exist per character of two bytes.

A wildcard has nothing to do with that.

Cor

Daniel N said:
Essentially I want a string to be able to define multiple instances.
Similar to using the (*) while doing a search. I posted this in
dotnet.general:

hWnd = FindWindow("CLASS NAME", *)
A string must be where the (*) is. Is there a way of making some kind of
wildcard so that function accepts every string instance?

To which someone replied;I should use the EnumWindows API along with the
GetClassName API.

But , after googleing I found
:http://www.vbaccelerator.com/home/vb/code/Libraries/Windows/Enumerating_Windows/article.asp
But still have no idea what do.
 
Perhaps he means comparing a string to a "template" provided by regular
expression
to see if it matches. In such a case, take a look at the "regex"
object.

-tom
Cor Ligthert [MVP] ha scritto:
Daniel,

This answer from you we have seen now twice, but it does probably for
nobody describe what you want to doe.

As Herfried already wrote (in another way) in an earlier message. A string
can contain any collection of characters,

A string is nothing more than an address in memory with a certain lenght. In
the positions of that it is possible to set that collection of charecters
(unicode) which exist per character of two bytes.

A wildcard has nothing to do with that.

Cor
 
Daniel N said:
Essentially I want a string to be able to define multiple instances.
Similar to using the (*) while doing a search. I posted this in
dotnet.general:

hWnd = FindWindow("CLASS NAME", *)
A string must be where the (*) is. Is there a way of making some kind of
wildcard so that function accepts every string instance?

You can simply pass 'Nothing' or 'vbNullString' to the second parameter to
find any window. However, I suggest to use 'EnumWindows' too:

<URL:http://groups.google.de/groups?q=dotnet+enumwindows+vb>
 
Baring regex, you can also achieve a like comparison with instring.

if string.instr(0,strTempValue,"this") >0 and
string.instr(0,strTempValue,"that") >0 then
'we have a this or that match
end if

regex might be a better way to go especially if you are searching for
something a pattern th?t or th?s where ? is the wildcard.
 
Back
Top