Hacker News new | ask | show | jobs
by jpindar 1694 days ago
I don't know c# at all, but it just took me 47 seconds.

I did know that a language like that must have a string function for it, the first result of my search was a docs.microsoft.com page with the syntax and examples.

1 comments

Yea, we don't know the circumstances of the question. Were they asked to implement string splitting from scratch to demonstrate their ability to do so, or was it just something they needed to use as a part of something else? Did they have access to docs or were they supposed to do it without any help? Something tells me the problem wasn't phrased as "google how to split a string in c#" so I assume there must've been more to it.

I don't know C# very well either. Taking 10 minutes to research the possible solutions and their pitfalls doesn't sound like a bad thing. What's the idiomatic way, and is there more than one commonly used way? What are the performance characteristics of each way? Are there any pitfalls and caveats (as e.g. strtok in C has when it comes threads or to strings that may have empty fields)? Do these ways modify the original string or do they produce copies? Is the delimiter a single character, a string, a regex?

This should indeed be simple and quick if all you need is to speedrun to an answer through Google. If you need to be thorough and understand the ins and outs of what you're doing, 10 minutes doesn't look like much at all for someone who doesn't have extensive & recent experience with the given language.