+ 1

String.trim() function

what the trim function actually does ?? I'm new to java someone explain please

23rd Jun 2017, 2:22 PM
Rajkamal A V K
Rajkamal A V K - avatar
2 ответов
+ 4
If you have spaces before and/or after the string, this function will remove them. this string... - " Do I have spaces before and after me? " ... will become - "Do I have spaces before and after me?"
23rd Jun 2017, 2:33 PM
Edson
Edson - avatar
+ 2
It gets rids of spaces before and after the string (leading and trailing). It returns the new string.
23rd Jun 2017, 2:23 PM
Frederik Bussler
Frederik Bussler - avatar