krakjoe / ustring

UnicodeString for PHP7
Other
64 stars 7 forks source link

provide a definition of whitespace for trim() #24

Open Wes0617 opened 8 years ago

Wes0617 commented 8 years ago

which characters will trim() trim?

whitespace is very subjective and different in every language, including unicode

i would use C#'s whitespace definition as default (https://msdn.microsoft.com/en-us/library/t809ektx(v=vs.110).aspx) plus the null byte as in php's trim() but i would also add an optional parameter "$charset" so that the behavior would be completely customizable

UString::trim(UString $charset = null)

hikari-no-yume commented 8 years ago

We're using ICU's UnicodeString to implement UString, but it doesn't seem to specify what 'whitespace' is: http://icu-project.org/apiref/icu4c/classicu_1_1UnicodeString.html#a3ede7f2dfe35b1afcce8d9ba20dbc83b