javascript - Break the string into two lines -


i want break string 2 lines, line should not break two, @ half of word. how can this?

the string format this:

var words="value.eight.seven.six.five.four.three" 

expected output is:

"value.eight.seven.  six.five.four.three" 

try this:

    var words="value.eight.seven.six.five.four.three"     var wordsarr = words.split(".");     var line1 = wordsarr.slice(0,math.floor(wordsarr.length/2)).join(".");      var line2 = wordsarr.slice(math.floor(wordsarr.length/2)).join("."); 

here working fiddle:

http://jsfiddle.net/6xgs2/


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -