- Comprehensive Ruby Programming
- Jordan Hudgens
- 86字
- 2021-07-02 21:13:28
Using the strip method
Let's start off by analyzing the strip method. Imagine that the input you get from the user or from the database is poorly formatted and contains white spaces before and after the value. To clean the data up, we can use the strip method. Consider this example:
str = " The quick brown fox jumped over the quick dog "
p str.strip
When you run this code, the output is just the sentence without the white spaces before and after the words:

推薦閱讀
- Beginning C++ Game Programming
- 信息可視化的藝術:信息可視化在英國
- Swift細致入門與最佳實踐
- RESTful Java Web Services(Second Edition)
- UNIX Linux程序設計教程
- Flink入門與實戰
- 從“1”開始3D編程
- Android嵌入式系統程序開發(基于Cortex-A8)
- 基于MATLAB的控制系統仿真及應用
- 基于JavaScript的WebGIS開發
- Java語言GUI程序設計
- Android Application Programming with OpenCV 3
- Natural Language Processing with Java Cookbook
- The PHP Workshop
- Developing Multi:Platform Apps with Visual Studio Code