javascript - Remove text between ( and ) in js variable -


this question has answer here:

i have got variable: var alma = 'ez itt (alma)'; output ez itt

how can it?

:-) it's substr in php, not need. variable example... have more variables, 100-200 , different lenght.

try this,

var alma = 'ez itt (alma)'; var output = alma.substring( 0, alma.indexof("(")-1 ); alert(output); 

update


if need replace values inside brackets , rest of string, try this

var output = alma.replace(/ *\([^)]*\) */g, ""); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -