Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB6
Expertise: beginner
Oct 14, 2000

ReverseFullName - Convert a full name into the "LastName, FirstName" format

' reverse a full name
'
' for example: ReverseFullName("John A. Smith") ==> "Smith, John A."

Function ReverseFullName(ByVal FullName As String) As String
    Dim i As Long
    ' search for the last space
    FullName = Trim$(FullName)
    i = InStrRev(FullName, " ")
    
    If i = 0 Then
        ' no space, just return the argument
        ReverseFullName = FullName
    Else
        ReverseFullName = Mid$(FullName, i + 1) & ", " & Left$(FullName, i - 1)
    End If
End Function
Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date