itortu
asked on
formatting first and last names.
how can I apply the formatting of the first and last names inside the property declaration intead that going to the formatting function?
Public Property Name() As String
Get
Return m_strFirstName & m_strLastName
End Get
Set(ByVal vData As String)
m_strLastName = Format_FixedString(Trim(Mi d(vData, 19, 15)), 15, eFixedFormatTypes.fftAlpha Numeric)
m_strFirstName = Format_FixedString(Trim(Mi d(vData, 1, 15)), 15, eFixedFormatTypes.fftAlpha Numeric)
End Set
End Property
thank you.
Public Property Name() As String
Get
Return m_strFirstName & m_strLastName
End Get
Set(ByVal vData As String)
m_strLastName = Format_FixedString(Trim(Mi
m_strFirstName = Format_FixedString(Trim(Mi
End Set
End Property
thank you.
Can you describe the format you are looking for in words rather than "Format_FixedString(Trim(M id(vData, 19, 15)), 15, eFixedFormatTypes.fftAlpha Numeric)"?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
I am do sure what you are looking for in the style of how you want the First Last name
So here is some code that I used in the past on looking for and adjusting names.
Imports System.Text.RegularExpress ions
'strName = "Last,First MI"
Private Sub UseRegularExpression(ByVal strName As String)
Dim regExp As New Regex("([a-zA-Z]{1,})\,{1} \s{0,}([a- zA-Z]{1,}) \s{0,}([a- zA-Z]{0,}) ")
Dim matchGroups As GroupCollection = regExp.Match(strName).Grou ps
' Last name
MsgBox(matchGroups(1).Valu e)
' First name
MsgBox(matchGroups(2).Valu e)
' Middle initial (If any)
MsgBox(matchGroups(3).Valu e)
End Sub
'******** OR.....
'strName = "Last First MI"
Private Function UpperToLower(ByVal strName As String)
Dim regExp As New Regex("([a-zA-Z]{1,})\s{1} \s{0,}([a- zA-Z]{1,}) \s{0,}([a- zA-Z]{0,}) ")
Dim matchGroups As GroupCollection = regExp.Match(strName).Grou ps
Dim str As String
' Last name
str = (UCase(matchGroups(1).Valu e.Substrin g(0, 1)) & LCase(matchGroups(1).Value .Substring (1)) & " ")
' First name
str += (UCase(matchGroups(2).Valu e.Substrin g(0, 1)) & LCase(matchGroups(2).Value .Substring (1)) & " ")
' Middle initial (If any)
str += (UCase(matchGroups(3).Valu e))
Return str
'OR YOU CAN USE
'Dim myTI As TextInfo = New CultureInfo("en-US", False).TextInfo
'Return myTI.ToTitleCase(strName)
End Function
So here is some code that I used in the past on looking for and adjusting names.
Imports System.Text.RegularExpress
'strName = "Last,First MI"
Private Sub UseRegularExpression(ByVal
Dim regExp As New Regex("([a-zA-Z]{1,})\,{1}
Dim matchGroups As GroupCollection = regExp.Match(strName).Grou
' Last name
MsgBox(matchGroups(1).Valu
' First name
MsgBox(matchGroups(2).Valu
' Middle initial (If any)
MsgBox(matchGroups(3).Valu
End Sub
'******** OR.....
'strName = "Last First MI"
Private Function UpperToLower(ByVal strName As String)
Dim regExp As New Regex("([a-zA-Z]{1,})\s{1}
Dim matchGroups As GroupCollection = regExp.Match(strName).Grou
Dim str As String
' Last name
str = (UCase(matchGroups(1).Valu
' First name
str += (UCase(matchGroups(2).Valu
' Middle initial (If any)
str += (UCase(matchGroups(3).Valu
Return str
'OR YOU CAN USE
'Dim myTI As TextInfo = New CultureInfo("en-US", False).TextInfo
'Return myTI.ToTitleCase(strName)
End Function