13

What would you go with, and why?

Comments
  • 7
    Besides of the simplicity is there any difference?

    My choice would be the second actually
  • 2
    @LMestre14 someone might add another space in the string and you might spend hours debugging your code
  • 0
    @kirill578 then go through the history for the file and see who broke it and how.
  • 3
    The second snippet is better but why not make it a constant?
  • 1
    Would do the first and add a comment on why you did that over the second one.
  • 4
    Especially if interpreted, the second, because the first requires a name lookup plus a cast. The second, in theory, should actually be faster because its a language built-in sort of thing, even though it seems like lazy code.
  • 0
    @AlgoRythm not sure if the JIT might be able to optimize the first one into the second one. That would definitely be dope as fuck.
  • 0
    If I want the separator to be whatever the system defines as the separator (like how Windows defines the line separator as CRLF and Linux as LF) then the first one (even if, at the moment, all systems define it the same way), but if I know I want it to be space regardless of what the "standard" is then the second one.
Add Comment