In my program I need to convert char[]
of fixed size into trimmed String (without blank spaces taken from an array). At the moment I do new String(array).trim()
but I would like to avoid trim()
if possible. Any advice how to do it better?
Best Regards.
but I would like to avoid trim() if possible. Any advice how to do it better?
Do not look for any alternative and trim()
is smart enough which uses substring()
method internally. That is fast enough.
Any looping or reg-ex based solutions will hit you hard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With