- 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:

推薦閱讀
- Extending Jenkins
- Learning Neo4j
- Learning ArcGIS Pro 2
- HTML5 and CSS3 Transition,Transformation,and Animation
- Java設計模式及實踐
- Building Machine Learning Systems with Python(Second Edition)
- Learning Node.js for .NET Developers
- Regression Analysis with Python
- C語言程序設計
- 跟戴銘學iOS編程:理順核心知識點
- NGUI for Unity
- Photoshop智能手機APP界面設計
- PhantomJS Cookbook
- WCF編程(第2版)
- 深入理解Zabbix監控系統