robert_gsfame Posted March 21, 2010 Share Posted March 21, 2010 I have this, assume that var input is dynamic where i can change at anytime i want var input="my name is james from canada x"; i really wish to remove the x from the var input.....in php i can use substr($mystring,"",-1) and i will get my name is james from canada how can i do this in javascript... Link to comment https://forums.phpfreaks.com/topic/196022-get-last-position-in-the-string/ Share on other sites More sharing options...
Alex Posted March 21, 2010 Share Posted March 21, 2010 var input = "my name is james from canada x"; alert(input.substr(0, input.length - 1)); Link to comment https://forums.phpfreaks.com/topic/196022-get-last-position-in-the-string/#findComment-1029659 Share on other sites More sharing options...
robert_gsfame Posted March 22, 2010 Author Share Posted March 22, 2010 Thx AlexWD Link to comment https://forums.phpfreaks.com/topic/196022-get-last-position-in-the-string/#findComment-1029815 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.