3

The OOP version of the code generated some thoughts around separation of concerns: user interactions and data processing. Single Responsibility Principle(SRP): Every module, class or function in a computer program should have responsibility over a single part of that program's functionality, and it should encapsulate that part. SRP would encourage ...


2

Your code does what you describe, but the code does not what it is really supposed to do. You are not the first person ever who needs to convert an arbitrary string into a form that can be embedded in a URL. Several people before you have already solved this problem. The crucial point is to know how these people named the method or function or class or ...


2

Review Welcome to Code Review. There are some suggestions as follows. Consider to use replaceAll The operation you performed is what String.replaceAll do, you can use replaceAll directly instead of String.toCharArray(), whitespace comparison, and sb.append things. Create a method URLify In order to improve usability, it is better to create a method URLify to ...


Only top voted, non community-wiki answers of a minimum length are eligible