★ wanayoo — archive 1999 http://www.php.net/manual/ja/function.trim.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to 文字列
Quick Reference
English version of this pageGerman version of this pageItalian version of this pageFrench version of this pageHungarian version of this page
文字列
* AddCSlashes
* AddSlashes
* bin2hex
* Chop
* Chr
* chunk_split
* convert_cyr_string
* count_chars
* crc32
* crypt
* echo
* explode
* flush
* get_html_translation_table
* get_meta_tags
* hebrev
* hebrevc
* htmlentities
* htmlspecialchars
* implode
* join
* levenshtein
* ltrim
* md5
* Metaphone
* nl2br
* ob_start
* ob_get_contents
* ob_end_flush
* ob_end_clean
* ob_implicit_flush
* Ord
* parse_str
* print
* printf
* quoted_printable_decode
* QuoteMeta
* rtrim
* sscanf
* setlocale
* similar_text
* soundex
* sprintf
* strcasecmp
* strchr
* strcmp
* strcspn
* strip_tags
* StripCSlashes
* StripSlashes
* stristr
* strlen
* str_pad
* strpos
* strrchr
* str_repeat
* strrev
* strrpos
* strspn
* strstr
* strtok
* strtolower
* strtoupper
* str_replace
* strtr
* substr
* substr_count
* substr_replace
* trim
* ucfirst
* ucwords
Manual: trim
View the source code for this pageSearch the site



Previous page
 substr_replace
 Updated
Mon, 14 Aug 2000
ucfirst 
Next page


trim

(PHP3 , PHP4 )

trim --  文字列の先頭および末尾にあるホワイトスペースを取り除く

説明

string trim (string str)

この関数は、文字列の先頭および末尾にあるホワイトスペースを 取り除き、その結果の文字列を返します。 現在のところ取り除かれるホワイトスペース文字は "\n"、"\r"、"\t"、"\v"、"\0"および通常のスペース(空白)です。

chop() および ltrim() も参照�さい。


User Contributed Notes: trim


brez@jordanchans.com
05-Jan-2000 11:40
It trims ALL leading and trailing spaces, one solution to the problem with explode()include spaces in the
array.



lars@xenux.dk
24-Jan-2000 11:57
If you have a string which only contains whitespace, then this function cannot strip the whitespace.


martin@coretrek.com
01-Jul-2000 09:38
how do strip whitespaces in the middle of a string, for instance if a user adds a space between his regin prefix and the rest of his phonenumber?
-martin



webmaster@nnytech.net
06-Jul-2000 12:45
An example

<?php
$stri = "\nThis string has \ whitespace\n\n\n";
echo trim($stri);
?>

Hope that helps..



alivesay@yellowbrix.com
24-Jul-2000 06:35
If you are trying to take out whitespace from the middle of a string, you need to use a different function, str_replace:

<PRE>str_replace(" ", "", "United Kingdom);</PRE>



 About Notes


Previous page
 substr_replace
 Updated
Mon, 14 Aug 2000
ucfirst 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.