1. Learn
  2. /
  3. Courses
  4. /
  5. Cleaning Data in Java

Connected

Exercise

Cleaning strings

You've extracted product names from your electronics inventory into a list of strings. The product names are messy, and some have leading and trailing spaces, non-letters, multiple spaces, or mixed cases. Clean the product names from your inventory.

Instructions

100 XP
  • Remove leading and trailing spaces from each product name.
  • Replace multiple spaces with a single space in the products.
  • Convert all product names to lowercase.