Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

String.trim() on read, create and update

 
Marcin Kowalski
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The old problem but I am confused a bit. I have the well known spec with null-termination stated and space-padding data file provided.

Because it seems obvious to trim when reading, find() should also trim to find anything. If so, for consistency, update() and create() methods should also trim input.

I think it is the most reasonable approach, but I am not sure if I won't get automatic failure with 'trimming everything'

What do you think?
 
Musab Al-Rawi
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there is no contradiction with trimming user's input then padding spaces at saving.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!