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... Quote 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)); Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.