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

minify - Minimizing css files -

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -