Answered step by step
Verified Expert Solution
Question
1 Approved Answer
to be familiar with regular expressions, do not use them for this problem. That would be too easy ) Examples of valid SSNs: 123-45-6789 123
to be familiar with regular expressions, do not use them for this problem. That would be too easy ) Examples of valid SSNs: 123-45-6789 123 45 6789 123456789 Examples of invalid SSNs: 123-45 6789 12345 6789 1SS-N4-SALE (6 pts) Your website from the previous problem stores most of its user registration information as strings in a database, and you want to ensure that it's consistently formatted. Specifically, you want to eliminate any leading and trailing spaces, and eliminate any extra spaces within the body of each string. Note that you're not removing ALL spaces from the string - only the extraneous ones! 2. Write a method trim(String s) that returns a version of the parameter s with all extra spaces removed as described above. Calling trim with a string of all spaces as the argument should return the empty string (i.e., the string containing no characters). Note: do not use the built-in trim method of the String class in your solution
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started