- 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.
- Expert C++
- 微服務(wù)與事件驅(qū)動(dòng)架構(gòu)
- x86匯編語言:從實(shí)模式到保護(hù)模式(第2版)
- C/C++常用算法手冊(cè)(第3版)
- PHP+MySQL+Dreamweaver動(dòng)態(tài)網(wǎng)站開發(fā)實(shí)例教程
- HTML5入門經(jīng)典
- C語言程序設(shè)計(jì)
- R Data Analysis Cookbook(Second Edition)
- 低代碼平臺(tái)開發(fā)實(shí)踐:基于React
- 零基礎(chǔ)學(xué)C語言(升級(jí)版)
- Qt 4開發(fā)實(shí)踐
- Learning Jakarta Struts 1.2: a concise and practical tutorial
- Application Development with Parse using iOS SDK
- 從零開始學(xué)Unity游戲開發(fā):場(chǎng)景+角色+腳本+交互+體驗(yàn)+效果+發(fā)布
- 和孩子一起學(xué)編程:用Scratch玩Minecraft我的世界