android - Java regex with reserved chars -


this question has answer here:

i'm using pattern string this

url = "http://mywebsite.com:1700/[lang]/service/?customerid=[customerid]"; 

i'm using code replace parameters.

url.replace("[lang]", languagename); 

also tryied :

url.replace("\\[lang\\]", languagename); 

but not worked.

java strings immutable. replace() returns new string , need capture it:

url = url.replace("[lang]", languagename); 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -