vb.net - Replace "," to the word "and" but avoid replace "and" inside the parenthesis -


sample:

my string = englishgrammar(verb,noun , adjectives),math(algebra,trigometric , geometric), science(physics,chemistry , ecology)

i want output this: englishgrammar(verb,noun , adjectives),math(algebra,trigometric , geometric) , science(physics,chemistry , ecology)

i have no idea how can fix this? using vb.net

so want replace last occurrence of string new string ..

private function replacelastoccurenceof(s string, texttoreplace string, newtext string) string     dim lastcommaindex integer = s.lastindexof(texttoreplace)     return s.remove(lastcommaindex, 2).insert(lastcommaindex, newtext) end function 

and use it

strtest = replacelastoccurenceof(strtest, "),", ") and") 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -