Welcome to collectivesolver - Programming & Software Q&A with Examples. A website you can trust. All programs tested and work.

Contact: aviboots(AT)netvision.net.il


Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Survey Junkie is the #1 place online for your audience to earn rewards for their opinion.

100%
Managed VPS Hosting
Affordable. Secure. Your Own Virtual Private Hosting. Faster than AWS and Rackspace

Bonsai Boy of New York Bonsai Trees and Accessories
Liquid Web - Highest Level of Performance and Security with Managed Dedicated Servers

Disclosure We are a professional Programming & Software Q&A website, that receives compensation from some of the links whose we show you with Information. It means that my content may contain affiliate links.

20,687 questions

27,329 answers

573 users

How to remove the middle name from a full name in VB.NET

1 Answer

0 votes
Imports System

Public Class Program
	Public Shared Sub Main()
        Dim name As String = "James John William"
		
        Console.WriteLine(name)
		
        Dim index1 As Integer = name.IndexOf(" ")
        Dim index2 As Integer = name.IndexOf(" ", index1 + 1)

        If index1 <> index2 AndAlso index1 >= 0 Then
            name = name.Remove(index1 + 1, index2 - index1)
            Console.WriteLine(name)
        End If
    End Sub
End Class



' run:
'
' James John William
' James William
'

 




answered Nov 23 by avibootz
...