Tuesday, 13 August 2013

Function to insert dash after three characters in a string?

Function to insert dash after three characters in a string?

I have a form in the input=text the user enters a number like 123456 i
want to change this to 123-456
How can I put a dash after a certain numbers of characters?
I tried many functions but all of them wants to change or relapse a
character and i don't want to change any thing i just want to insert a
dash - after three characters in the string.
thank you.
this is the code that takes the number from the user i want to put this
number in a function that insert the dash after three character in the
sting inserted buy the user
<tr>
<td> <small>RIG CHARGE:</small> </td>
<td> <input type="text" name="rch" value="<?php echo
$objWorksheet->getCellByColumnAndRow(6, 21)->getValue(); ?>"> </td>
</tr>

No comments:

Post a Comment