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

Is there a 'right' function in javascript

Status
Not open for further replies.

trojan800

Programmer
Nov 27, 2001
53
US
Can I manipulate a string in javascript with any similar functions to say right, left, mid etc. Particularly how would I isolate a word in a long string if I knew where the word started but not where it ended and wanted to search forward for the next space. Any help is greatly appreciated.
 
String.prototype.left = function(){
return this.substring(0,arguments[0])
}
String.prototype.right = function(){
return this.substring(this.length-arguments[0])
}
var str="abcdef
alert(str.left(3))
alert(str.right(3))

Adam
while(ignorance==true){perpetuate(violence,fear,hatred);life--};
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top