java - check if a word starts and ends with a character like %hello% -


making placeholders need able check string words start with, or contains '%' , end '%' letters in-between can't seem find solution.

for example, if check string "you have $%money%" need check %money% , remove '%' , keep 'money' there dollar sign infant of muck first character, example "the ip %ip%" need extract 'ip' string.

anyone got ideas? have searched google, website, , looked @ of functions available me use yet still cannot find anything.

a simple solution use string.replaceall method:

string s = "the ip %ip%"; s = s.replaceall("%", ""); system.out.println(s); 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -