Skip to content

Fix incorrectly escaped string.replace replace value#892

Merged
Perryvw merged 3 commits intoTypeScriptToLua:masterfrom
ark120202:string-replace-value-escape
Jun 10, 2020
Merged

Fix incorrectly escaped string.replace replace value#892
Perryvw merged 3 commits intoTypeScriptToLua:masterfrom
ark120202:string-replace-value-escape

Conversation

@ark120202
Copy link
Copy Markdown
Contributor

Fixes #865.

{ inp: "hello test", searchValue: "test", replaceValue: "" },
{ inp: "hello test", searchValue: "test", replaceValue: "world" },
{ inp: "hello test", searchValue: "test", replaceValue: "%world" },
{ inp: "hello test", searchValue: " test", replaceValue: "." },
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add some tests containing some of these other non-alphanumerics (both as search and replace values)?

{ inp: "hello %test", searchValue: "%test", replaceValue: "world" },
{ inp: "hello test", searchValue: "test", replaceValue: (): string => "a" },
{ inp: "hello test", searchValue: "test", replaceValue: (): string => "%a" },
{ inp: "aaa", searchValue: "a", replaceValue: "b" },
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove this? I don't think there is another test that replaces multiple references in the same string.

@Perryvw Perryvw merged commit f0410e0 into TypeScriptToLua:master Jun 10, 2020
@ark120202 ark120202 deleted the string-replace-value-escape branch June 11, 2020 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

String replace error when using slash in String.replace

2 participants