javascript - get first word in java script websockets -



javascript - get first word in java script websockets -

i using websockets in java script , string manipulation on message receive other end of websocket. strip off characters first word in message. illustration if message lets go party manipulate string lets. thinking go through string index index until nail first white space. not sure syntax in javascript. sound right or there improve way it? sorry if trivial quite new javascript.

simple:

var themessage = 'hello world!'; var thefirstword = themessage.split(' ')[0]; // 'hello'

javascript string websocket substring

Comments

Popular posts from this blog

php - How to pass multiple values from url -

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

database - php search bar when I press submit with nothing in the search bar it shows all the data -