dotnet / dotnet/vblang

Proposal: Better Strings.Replace function

Open
#390 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
328
Forks
71
PR merge metrics
No merged PRs in 30d

Description

I found that the `Microsoft.VisualBasic.Strings.Replace` function had a strange behavior.
The following program replaces Japanese full-width characters "ポ" and half-width characters "ポ" with "po":
```vbnet
Module Program
Sub Main(args As String())
Dim replaced = Replace("ポポポポ",
Find:="ポ", Replacement:="po",
Compare:=CompareMethod.Text)
MsgBox(replaced)
End Sub
End Module
```
The expected result is "popopopo". But actually the value of `replaced` is "popo". It's inconsistent with the `Range.Replace` function of Excel. Is this a bug?
If it's by design (for better performance or back-compatibility), I recommend adding another "Replace" function (Overloads the original `Replace` and optionally mark the original `Replace` obsolete) to help us reduce the number of bugs written in the future.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.