Skip to content

fix(js/ts): endsWith regression for empty pattern with non-ordinal comparison - #4745

Merged
MangelMaxime merged 4 commits into
fable-compiler:mainfrom
Thorium:fix-string-endswith-empty
Jul 9, 2026
Merged

MangelMaxime merged 4 commits into
fable-compiler:mainfrom
Thorium:fix-string-endswith-empty

Conversation

@Thorium

@Thorium Thorium commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

str.slice(-pattern.length) becomes slice(-0) === slice(0) (the whole string) when pattern is empty, so EndsWith("") returned false for culture/ignore-case comparisons. .NET returns true (every string ends with ""). Use slice(str.length - pattern.length) instead.

(split from #4738)

@dbrattli dbrattli changed the title fix: endsWith regression for empty pattern with non-ordinal comparison fix(js/ts): endsWith regression for empty pattern with non-ordinal comparison Jul 9, 2026
Thorium and others added 4 commits July 9, 2026 18:41
…mparison

str.slice(-pattern.length) becomes slice(-0) === slice(0) (the whole
string) when pattern is empty, so EndsWith("") returned false for
culture/ignore-case comparisons. .NET returns true (every string ends
with ""). Use slice(str.length - pattern.length) instead.
@MangelMaxime
MangelMaxime force-pushed the fix-string-endswith-empty branch from a5b73f8 to 9d456d5 Compare July 9, 2026 18:46
@MangelMaxime
MangelMaxime merged commit bad6bca into fable-compiler:main Jul 9, 2026
23 of 24 checks passed
@MangelMaxime

Copy link
Copy Markdown
Member

Thank you

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.

2 participants