I have a problem I want to change the length of string. This is my string of characters that I want to change.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim .
I use substring function in javascript but the outputs is not like I need.
this is my code
var str="Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ";
document.write(str.substring(100)+"<br />");
but the output is like this
laoreet dolore magna aliquam erat volutpat. Ut wisi enim
My goal is just to make the length of that string of character to be 100 starting from the first character.
how i can solve this…thanks for your answer
It appears english is a second language for you and your question is very unclear. But based on what you posted I am guessing you want to truncate a string. This is straightforward using javascript’s string methods.
http://www.quirksmode.org/js/strings.html