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
Post a Comment