Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Extract Strings
Author:
Mark Anthony Dinglasa
Submitted:
9/26/2014
Version:
VB 2013
Compatibility:
VB 2005, VB 2008, VB 2010, VB 2012, VB 2013
Category:
String Manipulation
Views:
6235
Function to extract strings.
Declarations:
'none
Code:
Public Function ExtractString(ByVal CompleteMessage As String, ByVal BeginString As String, ByVal EndString As String) As String Dim BeginPosition As Integer = 0 Dim EndPosition As Integer = 0 Dim curValue As String = "" BeginPosition = InStr(CompleteMessage.ToUpper, BeginString.ToUpper) If BeginPosition = 0 Then curValue = "" End If If EndString.ToUpper.Length Then EndPosition = InStr(BeginPosition + BeginString.ToUpper.Length, CompleteMessage.ToUpper, EndString.ToUpper) Else EndPosition = 0 End If If Len(UCase(EndString)) Then If EndPosition Then curValue = Mid(CompleteMessage.ToUpper, BeginPosition + BeginString.ToUpper.Length, EndPosition - BeginPosition - BeginString.ToUpper.Length) Else curValue = Mid(CompleteMessage.ToUpper, BeginPosition + BeginString.ToUpper.Length) End If Else curValue = Mid(CompleteMessage.ToUpper, BeginPosition + BeginString.ToUpper.Length) End If Return curValue End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement