Good morning, I've been trying to replace a text string that has hard spacing or non breaking space, but I do not get it in any way, I tried the following codes in a function and it just does not work with any:
Private Function RepChar10(ByVal text As String) As String
Dim toChange As String
toChange = text
toChange = toChange.Replace("\u00A0", " ")
toChange = toChange.Replace(Chr(160), " ")
toChange = Replace(Replace(text, " ", ""), "nbsp", "")
toChange = Replace(Replace(text, Chr(10), " "), Chr(13), " ")
RepChar10 = toChange
End Function
If anyone knew a way to eliminate it, thank you very much in advance!
Greetings!
Update, solution: How about, solve it leaving the code as follows:
Private Function RepChar10(ByVal text As String) As String
Dim toChange As String
toChange = text
toChange = toChange.Replace(",", " ")
toChange = toChange.Replace(Chr(160), " ")
toChange = toChange.Replace(Chr(13), "")
toChange = toChange.Replace(Chr(10), "")
RepChar10 = toChange
End Function
The only detail is that it replaces the accents and the ñ by other characters, but I think it's the least