我的套管功能有问题。我使用替换将所有连词更改为较低的但我仍然有一个错误>
Private Function UpCsing(ByVal sValue As String) As String
Dim toConvert As String() = sValue.Split(" ")
Dim lst As New List(Of String)
For i As Integer = 0 To toConvert.Length - 1
Dim converted As String = ""
If toConvert(i).Contains("^") Then
converted = toConvert(i).ToUpper.Replace("^", "")
Else
converted = StrConv(toConvert(i), VbStrConv.ProperCase).Replace("^", "")
End If
lst.Add(converted)
Next
Dim ret As String = ""
For i As Integer = 0 To lst.Count - 1
If i = 0 Then
ret = lst(0)
Else
ret += " " + lst(i)
End If
Next
Return ret.Replace(" For ", " for ").Replace(" In ", " in ").Replace(" Of ", " of ").Replace(" And ", " and ").Replace(" And/Or ", " and/or ").Replace(" By ", " by ") _
.Replace(" By ", " by").Replace(" 2Nd ", " 2nd ").Replace(" 3Rd ", " 3rd ").Replace(" At ", " at ").Replace("And/Or ", "and/or ").Replace("1St", "1st").Replace("2Nd", "2nd").Replace("3Rd", "3rd") _
.Replace("At ", "at ").Replace(" At", " at").Replace(" Of", " of").Replace(" & ", " and ").Replace("Poc", "POC").Replace(" As ", " as ") _
.Replace("C/O", "c/o").Replace("$ ", "$").Replace(" And/Or ", " and/or ")
End Function
错误示例:'For' 应该是 'for' 但我的输出中的单词 'Forward' 必须是 'Forward' 将其更改为 'forward'
示例 'For the main event and for us to forward' 输出应该是 'For the Main Event and for us to Forward'