|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
substring function in VB6?
ok, java and C# and a few others all have a .substring function. I want to know if VB6 has the same (or similar) thing in it. I know VB.NET does, but i am to tight to buy .Net stuff at the moment, so i need to try and do it in vb6 if possible. Any help greatly appreciated.
__________________
"Operator, Give me the number for 911" - Homer J Simpson JonnoWalmsley.com vv Latest Image vv
|
|
#2
|
||||
|
||||
|
VB5 & 6 have tons of functionality for manipulating strings... Mid(), Right(), Left(), Split(), Join()... I'm guessing that you are wanting to know if you can pull certain values out of a string? Mid is the most general of the functions.. you can do something like...
Code:
Private Sub Form_Load() Dim strA As String Dim strB As String Dim intLength As Integer strA = "Give me a candy cane or I'll beat you to death" 'returns strb="candy" strB = Mid(strA, 11, 5) MsgBox strB 'returns strb="candy cane or" intLength = (InStr(strA, "or") - InStr(strA, "c") + 2) strB = Mid(strA, InStr(strA, "c"), intLength) MsgBox strB End Sub
__________________
Fisherman "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein |
|
#3
|
|||
|
|||
|
Also, you can use the InStr function to locate a substring position in a string.
You can find the vb functions reference online here http://msdn.microsoft.com/library/e...cLROverview.asp |
|
#4
|
||||
|
||||
|
ok, my next question is.....is there a version of java's .lenght() function?
|
|
#5
|
||||
|
||||
|
len(strYourString)
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > substring function in VB6? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|