Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,959 questions

51,901 answers

573 users

How to extract substring between single quotation marks in VB.NET

1 Answer

0 votes
Imports System

Public Class ExtractSubstringBetweenSingleQuotationMarks
	Shared Function ExtractSubstring(ByVal str As String) As String
        Dim startPos As Integer = str.IndexOf("'"c)
		
        If startPos <> -1 Then
            Dim endPos As Integer = str.IndexOf("'"c, startPos + 1)
            If endPos <> -1 Then
                Return str.Substring(startPos + 1, endPos - startPos - 1)
            End If
        End If
		
        Return String.Empty
    End Function
	
    Public Shared Sub Main()
		Dim str As String = "VB.NET is a 'multi-paradigm' programming language"
        
		Dim subString As String = ExtractSubstring(str)
		
		Console.WriteLine("'" & subString & "'")
    End Sub
End Class

 
 
' run:
'
' 'multi-paradigm'
'

 



answered Feb 11, 2025 by avibootz

Related questions

...