|
-
Oct 5th, 2000, 11:24 AM
#1
Thread Starter
New Member
I I have a string and I would like to only use a portion of the string, what function should I use?
For example:
strString = "This is fun!"
I want to use "This is" only
How would I cut off everthing after "_f" and only use "This is"
Thanks for any help, VolFans
-
Oct 5th, 2000, 11:41 AM
#2
Addicted Member
Left$(strString,InstrRev(strString," ")-1)
-------------------------------
Visual Basic Professional 6.0
-
Oct 5th, 2000, 11:44 AM
#3
Fanatic Member
Dim strArray() As String
Dim strTest as String
strTest = "This Is A Test"
'Use the Split Function
strArray = Split(strTest, " ")
MsgBox strArray(1)
MsgBox strArray(2)
HTH
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Oct 5th, 2000, 11:45 AM
#4
_______
<?>
Code:
'slight drawback..it finds the first f
'that could be a problem
Option Explicit
Private Sub Command1_Click()
Dim SearchString, SearchChar, MyPos
SearchString = "This is fun." ' String to search in.
SearchChar = "f"
MyPos = InStr(1, SearchString, SearchChar, 1)
'if found MyPos will be > 0
If MyPos > 0 Then
SearchString = Left(SearchString, MyPos - 1)
SearchString = Trim(SearchString)
MsgBox SearchString
End If
End Sub
[Edited by HeSaidJoe on 10-05-2000 at 01:02 PM]
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
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
|