Talk:Z11170

Wikifunctionsmanta
Último comentario: 9 dis 2023 por DannyS712 en el tema 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)Responder

@Nneonneo fixed --DannyS712 (talk) 00:25, 9 December 2023 (UTC)Responder