vb.net-2010

Why Does Replace Return Nothing on Empty String


Replace("",vbLf, "")

Go figure.

It should return ""

No. It returns nothing.

Just put the code in vb.net

I think it should return "". Replace all occurance of vbLF with "". Because the original string is "" then it simply replace nothing and we got back ""

\No. We got back nothing.


Solution

  • You are using Visual Basic string functions, not .Net. The Visual Basic runtime usually evaluates Nothing as an empty string ("").