Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

striping characters from strings 1

Status
Not open for further replies.

mrmtek

Programmer
Joined
Oct 13, 2002
Messages
109
Location
AU
is there away of stripping unwanted characters from strings and replacing them with other characters.
for example is a string contains a ' I want to replace it with a space, is this possible.
 
Here is an example of removing a leading 0.

$num = 0.4567;

$result=preg_replace("/^0*/","",$num);

echo "$result";

 
I wouldn't use something as resource-intensive as a regular expression for something as simple as removing a leading zero.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top