You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just remarked by reading the source of the strings.FieldsFunc that the method will also remove empty fields from its return value. For example, see the following playground.
Seeing that the used algorithm isn't the same than the one for the splits, I wonder if it is an undocumented feature or a bug ?
The text was updated successfully, but these errors were encountered:
ianlancetaylor
changed the title
Undocumented behavior of strings.FieldsFunc
strings: Undocumented behavior of strings.FieldsFunc
Aug 27, 2015
The behaviour of FieldsFunc seems to match the documentation. It splits the string at each run of code points satisfying the function. This is different from the documentation of Split, which returns substrings separated by sep--not a run of sep, just sep. So I think this is working as intended.
I'm going to close this issue, but please feel free to reopen if you disagree.
I just remarked by reading the source of the
strings.FieldsFunc
that the method will also remove empty fields from its return value. For example, see the following playground.Seeing that the used algorithm isn't the same than the one for the splits, I wonder if it is an undocumented feature or a bug ?
The text was updated successfully, but these errors were encountered: