java - Can a regular expression be used for getting a substring? -
i'm writing code java fx code evaluate button being clicked, need compare id of getsource
string.
i'm getting strings like:
button[id=playbutton, styleclass=button]
button[id=pausebutton, styleclass=button]
button[id=stopbutton, styleclass=button]
button[id=nextbutton, styleclass=button]
so according button being clicked perform statements. using set of if
, else if
's evaluating contains(id)
id play, pause, stop , next.
i'd better use switch every case play, pause, stop , next. how can substring, getting of either play, pause, stop or next?
why need regex, when simple indexof("id="), lastindexof ("button,") , substring of previous 2 calls work fine?
Comments
Post a Comment