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)Reply

@Nneonneo fixed --DannyS712 (talk) 00:25, 9 December 2023 (UTC)Reply
M513x542S1ce50491x458S22a00492x492S14c50487x511 M530x529S10018470x471S10641507x501S26505486x480S21600500x494 https://www.wikifunctions.org/w/index.php?title=Talk:Z11170&oldid=64772
Return to "Z11170" page.