On Sat, Dec 7, 2024 at 7:35 AM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > Christian Couder <christian.couder@xxxxxxxxx> writes: > > > We often have to split strings at some specified terminator character. > > The strbuf_split*() functions, that we can use for this purpose, > > return substrings that include the terminator character, so we often > > need to remove that character. > > > > When it is a whitespace, newline or directory separator, the > > terminator character can easily be removed using an existing triming > > function like strbuf_rtrim(), strbuf_trim_trailing_newline() or > > strbuf_trim_trailing_dir_sep(). There is no function to remove that > > character when it's not one of those characters though. > > Heh, totally uninteresting (alternative being open coding this one). > If we pass, instead of a single character 'c', an array of characters > to be stripped from the right (like strspn() allows you to skip from > the left), I may have been a bit more receptive, though ;-) Yeah, I realized strbuf_strip_suffix() can do the job in the following patches, so I dropped this patch and used strbuf_strip_suffix() in the version 4 of this series.