在字符串上,我必须在字符串中添加一些空格以进行填充,如下所示:
Dim whiteSpace As Char = CChar(HttpUtility.HtmlDecode(" "))
tempDisplay.Append(whiteSpace, paddingNeeded)
会给我类似的东西:
A99 - More Text
现在稍后,我需要删除该空间。我试过了:
Dim indexOfDash As Integer = curLinkBtn.Text.IndexOf("-")
Dim testForWhiteSpace As Integer = indexOfDash - 2
Dim whiteSpace As String = " "c 'This and nbsp are both in just to see if they would work
Dim nbsp As Char = CChar(HttpUtility.HtmlEncode(" "))
'See if there has been whitespace injected at all
If Char.IsWhiteSpace(curLinkBtn.Text(testForWhiteSpace)) Then
Dim regReplave As String = Regex.Replace(curLinkBtn.Text, whiteSpace, "!", RegexOptions.IgnoreCase)
'That produces A99 -!More!Text
Dim regReplaveNbsp As String = Regex.Replace(curLinkBtn.Text, nbsp, "*", RegexOptions.IgnoreCase)
'On this I don't even get the '*'
curLinkBtn.Text = regReplave
Dim testChar As Char = curLinkBtn.Text(testForWhiteSpace)
End If
感谢您的任何指点