Skip to content

Instantly share code, notes, and snippets.

@Neme12
Last active December 12, 2021 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neme12/dfebe11d09909f8d7bbb6463d194c2a9 to your computer and use it in GitHub Desktop.
Save Neme12/dfebe11d09909f8d7bbb6463d194c2a9 to your computer and use it in GitHub Desktop.
int count = 0;
var span = source.AsSpan();
while (true)
{
var index = span.IndexOf('/');
if (index == -1)
break;
count++;
span = span.Slice(index + 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment