<script type="text/javascript"> var cad='algo-bu-'; cad=cad.substr(cad.length-1,1)=='-'?cad.substring(0,cad.length-1):cad; alert(cad) </script>