Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Remove White Spaces from the Beginning and/or the End of a String
How To Remove White Spaces from the Beginning and/or the End of a String? - PHP Script Tips - PHP Built-in Functions for Strings
✍: FYIcenter.com
There are 4 PHP functions you can use remove white space characters from the beginning and/or the end of a string:
White space characters are defined as:
Here is a PHP script example of trimming strings:
<?php $text = "\t \t Hello world!\t \t "; $leftTrimmed = ltrim($text); $rightTrimmed = rtrim($text); $bothTrimmed = trim($text); print("leftTrimmed = ($leftTrimmed)\n"); print("rightTrimmed = ($rightTrimmed)\n"); print("bothTrimmed = ($bothTrimmed)\n"); ?>
This script will print:
leftTrimmed = (Hello world! ) rightTrimmed = ( Hello world!) bothTrimmed = (Hello world!)
2007-04-22, 5227👍, 0💬
Popular Posts:
How many types of validation controls are provided by ASP.NET ? There are six main types of validati...
.NET INTERVIEW QUESTIONS - Did VB6 support multi-threading ? While VB6 supports multiple single-thre...
Jack developed a program by using a Map container to hold key/value pairs. He wanted to make a chang...
.NET INTERVIEW QUESTIONS - What are Daemon threads and how can a thread be created as Daemon? Daemon...
How To Increment Dates by 1? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have a...