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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing hyphens! 1

Status
Not open for further replies.
Feb 16, 2003
87
GB
Hello! I'm using this short piece of code to make $shortusername the first 20 characters of the variable $FORM{'domain'}.

$shortusername = substr($FORM{'domain'},0,20);

. . . but I need to be able to remove any hyphens that might be in the $FORM{'domain'} variable - how would I go about doing that?

Thanks in advance.

Simon
 
Once you have the value in $shortusername do a substitution on it.

$shortusername =~ s/-//g;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top