Jump to content

Removing Alphabetical characters from string


Silverado_NL

Recommended Posts

hi everybody, im currently trying to automate the process of cleaning up Telephone Fields.

currently there are loads of fields in the database that contain both alphabetical characters and integer characters.

is there a command to remove these alphabetical characters in the string????

my goal is to end up with only number and no other characters.

if anybody has a clue, i'd sure like to know:)

 

Thanks you in advance.

 

 

 

Silverado

Link to comment
Share on other sites

my goal is to end up with only number and no other characters.

 

In that case you need to make a little change with Iceman's script:

<?php

$string = "123This is the string that needs to have letters stripped from it, leaving: 1, 2, 3, 4, 5, ...";
$new_string = ereg_replace("[^0-9]", "", $string );
//$new_string now holds 12312345

?>

 

 

Orio.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.