Closed ZeroFactor closed 8 years ago
Do you mean the syntax or the actual value, because the syntax cannot be .isEmpty as that would be a redeclaration of the existing .isEmpty in swift. The difference between isEmpty in swift and this .isEmpty() is that .isEmpty() will trim whitespace and newline characters before testing if the string is empty, whereas Swift's .isEmpty will not.
Swift would return false for
" ".isEmpty
I should have been more clear.
I was expecting "".isEmpty()
to be true
, but it is false
. If it was true
, this could be a nice replacement for String.isEmpty
. Instead it seems like it is intended to detect if the string has content and that all of the content is whitespace.
That makes sense. I'll add a fix for that to my currently open pull request
Thanks! Merged in
If this was intentional could someone add something to the documentation about why?