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

remaining string

Status
Not open for further replies.

Oostwijk

Technical User
Oct 19, 2003
82
0
0
NL
How can I remove the first character of a variable ?
 
Hi,

This should do the trick ...

$var1 = "1234567890";
$var2 = substr ($var1,1);

 
I assume you mean the first letter of a string.

There are a number of ways to do this (in true perl style), such as;

$string = s/^[A-Za-z]{1}([A-Za-z]+)$/$1/;
Assuming you have a letter in first place.

or even;

$string = reverse($string);
chop $string;
$string = reverse($string);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top