Search for Partial Sting

Search for Partial Sting

Anonymous
Not applicable
263 Views
6 Replies
Message 1 of 7

Search for Partial Sting

Anonymous
Not applicable
Hi, Me again. Could anyone please tell me an EASY way to search a string for a specific word (or group of text). I have a variable set to be the result of an input box, I then want to search other strings for an occurance of this word, you know kind of "if BlockAttribute.textstring = * variable * then do something" Where * = any text... Any help would greatly appreciated. THANKS! Dave. K
0 Likes
264 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Look at InStr in the vba help. It returns the start
position (as a long) of the requested string. It returns 0 if the string isn't
found.

Glen

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hi,
Me again. Could anyone please tell me an EASY way to search a string for a
specific word (or group of text). I have a variable set to be the result of an
input box, I then want to search other strings for an occurance of this word,
you know kind of "if BlockAttribute.textstring = * variable * then do
something" Where * = any text... Any help would greatly appreciated. THANKS!
Dave. K
0 Likes
Message 3 of 7

Anonymous
Not applicable
You can use the AcadXTextProcessor class in AcadX to search
for and replace partial strings in text and attributes.

http://www.caddzone.com/acadx/acadx15.htm

"KingCAD" wrote in message
news:f0ed296.-1@WebX.maYIadrTaRb...
> Hi, Me again. Could anyone please tell me an EASY way to search a string
for a specific word (or group of text). I have a variable set to be the
result of an input box, I then want to search other strings for an occurance
of this word, you know kind of "if BlockAttribute.textstring = * variable *
then do something" Where * = any text... Any help would greatly appreciated.
THANKS! Dave. K
>
0 Likes
Message 4 of 7

Anonymous
Not applicable
Thank you VERY much, I just stumbled accross that a short time ago and found a way to make it do what I wanted. So it's on to the next stumbling block. I thank you ALL for your help!! Dave. K
0 Likes
Message 5 of 7

Anonymous
Not applicable
Take a look at the Like operator.  It offers
wild card matching.

 

If BlockAttribute.textstring Like "*" &
variable & "*" Then

    'do your thing



style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hi,
Me again. Could anyone please tell me an EASY way to search a string for a
specific word (or group of text). I have a variable set to be the result of an
input box, I then want to search other strings for an occurance of this word,
you know kind of "if BlockAttribute.textstring = * variable * then do
something" Where * = any text... Any help would greatly appreciated. THANKS!
Dave. K
0 Likes
Message 6 of 7

Anonymous
Not applicable
That looks like what I was looking for in the first place - I'll give it a shot! THANKS! Dave. K
0 Likes
Message 7 of 7

Anonymous
Not applicable
Check out "Regular Expressions" (you have to a add
a reference to vbscript.dll). They are totally awesome. They go far beyond
searching for strings and can look for patterns of characters. If you want to
find strings that MAY include line breaks or punctuation this is the way to go.
Look at
href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/reconIntroduct...
 for
all the details.
0 Likes