Talk:Z11170

๐‘„ฃ๐‘„ฌ๐‘„‘๐‘„ฌ๐‘„ฅ๐‘„ด๐‘„‘๐‘„ด ๐‘„‡๐‘„ง๐‘„Ÿ๐‘„ฌ๐‘„š๐‘„ด๐‘„‘๐‘„ด: ๐‘„ผ months ago ๐‘„˜๐‘„ข DannyS712 ๐‘„ƒ๐‘„ฌ ๐‘„‘๐‘„ฎ๐‘„›๐‘„จ๐‘„‡๐‘„ด Existing implementations are broken if the suffix is empty

Existing implementations are broken if the suffix is empty

The common approach of slicing with [:-len(suffix)] is wrong when the suffix is empty; the slice will produce an empty string, whereas the expected behaviour is to produce the original string unchanged ("removing" the empty suffix). Although uncommon, such a case can arise when dealing with programmatically-generated suffixes, and there's no indication that the function requires a non-empty suffix to operate. I've added a test case but am unable to edit the existing implementations. The easiest fix is to add a check that the suffix is non-empty. nneonneo talk 21:37, 6 December 2023 (UTC)๐‘„ก๐‘„ฎ๐‘„›๐‘„ด ๐‘„˜๐‘„ฌ๐‘„š

@Nneonneo fixed --DannyS712 (talk) 00:25, 9 December 2023 (UTC)๐‘„ก๐‘„ฎ๐‘„›๐‘„ด ๐‘„˜๐‘„ฌ๐‘„š
๐‘„ƒ๐‘„จ๐‘„ ๐‘„ฎ๐‘„–๐‘„ด๐‘„ช๐‘„š๐‘„ด ๐‘„ฃ๐‘„ง ๐‘„ฆ๐‘„ฎ๐‘„ ๐‘„ฌ "https://www.wikifunctions.org/w/index.php?title=Talk:Z11170&oldid=64772"
"Z11170" ๐‘„›๐‘„˜๐‘„–๐‘„ด ๐‘„œ๐‘„ฌ๐‘„ข๐‘„ง๐‘„–๐‘„ด ๐‘„ก๐‘…