- Comprehensive Ruby Programming
- Jordan Hudgens
- 204字
- 2021-07-02 21:13:27
A practical implementation
Now, you may be wondering why it's helpful to manipulate strings. It's cool to see, but is there any practical value? Let me walk you through a real-world case study to illustrate the importance of string manipulation.
Whenever I'm building a search engine inside an application that I'm working on, there are many times where I need to convert the case of either the value being searched for or the value from the database. For example, if a user wants to search for the Milk word, it's highly likely that my database query will not return the associated record or information because it does not handle case sensitivity well by default. If I have the milk word in my database, it wouldn't be returned because database searches are case sensitive. On the other hand, if I convert the entire word to an uppercase or lowercase value, depending on how the database is setup, the database query will work properly and return the correct results. This is one example of the importance of string manipulation in programming.
With regard to string manipulation, we've only touched the basics. Refer to the String class documentation (http://ruby-doc.org/core-2.2.0/String.html) to see the full list of methods.
- Mobile Web Performance Optimization
- 編程的修煉
- 小程序實戰視頻課:微信小程序開發全案精講
- 數據庫系統原理及MySQL應用教程
- Podman實戰
- Building a Quadcopter with Arduino
- OpenShift在企業中的實踐:PaaS DevOps微服務(第2版)
- TradeStation交易應用實踐:量化方法構建贏家策略(原書第2版)
- Mastering Drupal 8 Views
- Learning Laravel's Eloquent
- ASP.NET開發與應用教程
- RESTful Java Web Services(Second Edition)
- C語言程序設計習題與實驗指導
- Web程序設計:ASP.NET(第2版)
- PHP+MySQL Web應用開發教程