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

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

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -