|
-
Jun 3rd, 2001, 01:50 PM
#1
Thread Starter
Frenzied Member
Quick question - help with formatting a string..
-
Jun 3rd, 2001, 01:58 PM
#2
Junior Member
Use the VB built in function mid to grab any characters at any position, this of course is only any use if you know the characters you are looking for:
-
Jun 3rd, 2001, 02:03 PM
#3
Thread Starter
Frenzied Member
i have no clue how to use mid..
-
Jun 3rd, 2001, 02:05 PM
#4
Junior Member
Sorry about that, I hit the bloody enter key, the code would look something like this:
Dim Somevariable As String
Dim TargetVariable As String
TargetVariable = "http://me.home.books.wam"
SomeVariable = mid(TargetVariable,8,7)
SomeVariable = "me.home"
8 Being the start position
7 Being the length of characters required
Hope this helps,
JohnC.
-
Jun 3rd, 2001, 02:35 PM
#5
Thread Starter
Frenzied Member
-
Jun 3rd, 2001, 02:58 PM
#6
Addicted Member
You have to be more specific, we can't read minds (at least not at this distance)
Do you want to eliminate all the similar home directories?
-
Jun 3rd, 2001, 05:14 PM
#7
As mentioned above you have to be more specific, but you might want to look up:
InStr function or the Like operator.
-
Jun 3rd, 2001, 06:27 PM
#8
Registered User
-
Jun 3rd, 2001, 06:37 PM
#9
Member
yeah, youd want to use the InStr function to search the listbox...
use for & next statements also
for i = 0 to list.listcount - 1
if instr(list.list(i), "me.server.com") then
list2.additem list.list(i)
end if
next i
something like that should work although youll have to change that for your own needs...
im not sure if thats what you wanted but i decided to post it anyways.
read up on the instr function and for, next statement to learn more about using it.
-
Jun 3rd, 2001, 06:49 PM
#10
Use the Like operator.
Code:
Dim strMainString as String
Dim strSubString as String
'Set strMainString equal to one of the list1 items here
'Set strSubString equal to the substring that you want
'to find in the strMainString
'Use the * symbol for wild card example:
strSubString = "http://me.server.com/items/" & "*"
'That will allow it to match up with anything that has
'the same path, even though they are different file names.
If (strMainString Like strSubString) then
'add strMainString to your 2nd list box
End if
Hope that helps, if you need more information about the Like operator, ask, and I will post what the MSDN library has on it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|