Striping unwanted characters from string
| From: | Carlos Fernando | Date: | Tue, 12 Dec 2000 17:49:45 +0000 |
| Subject: | Striping unwanted characters from string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-29911@lists.php.net to get a copy of this message | ||
Hello All,
I was wondering if someone could help me with this :
I need to strip unwanted characters from a string.
My system has a search script to search parts by partnumber. The
Database only holds Partnumbers with characters from A to Z and 0 to 9.
Alls characters such as blank space, -, _, * , @ , # & , {, } ,[ , ] : ,
; '" should be ignored. The problem is that if a customer is looking
for partnumber 1234 and he types 123-4 he ain't find anyhting. So I need
a function to get a string parameter and return a result string with
nothing but 0 to 9 and A to Z.
I understarnd PHP has some built in string functions such as Trim() and
ltrim() for blank spaces.
Has anyone done this before? I would apreciate a few hints.
thank you,
Carlos Fernando Scheidecker Antunes