---
title: "Add string after a specified string"  
description: "Add string after a specified string"  
author: "Anonymous User"  
published: 2013-05-13  
updated: 2013-05-13  
canonical: https://www.mindstick.com/forum/875/add-string-after-a-specified-string  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Add string after a specified string

Hi Guys!\
[Say](https://answers.mindstick.com/qa/116645/a1-wreckers-reviews-what-do-customers-say) I have the following [HTML](https://www.mindstick.com/articles/1530/design-a-simple-stylish-calculator-using-html-css-and-javascript) [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp)\
<head></head><[body](https://yourviews.mindstick.com/story/2120/rare-species-having-electricity-in-their-body)><img src="stickman.gif" width="24" height="39" alt="Stickman"><a href="http://www.mindstick.com">Mindstick</a></body> \
I want to [add](https://www.mindstick.com/forum/12983/add-address-in-textbox-when-page-is-load-and-if-i-search-address-in-textbox-show-in-map-by-javascript) a string in between the <head> tags. So the final HTML string become\
<head><[base](https://www.mindstick.com/articles/12627/how-can-predictive-analytics-enhance-customer-base-and-experience) href="http://www.minstick.com/images/"></head>\
<body><img src="stickman.gif" width="24" height="39" alt="Stickman"><a href="http://www.mindstick.com">Mindstick</a></body> \
So I have to [search](https://www.mindstick.com/articles/65368/best-smo-services-company-in-hyderabad-improve-search-rankings) for the first occurrence of the <head> string then [insert](https://www.mindstick.com/blog/173/executing-insert-delete-or-update-query-in-sqlserver-using-ado-dot-net) <base href="http://www.mindstick.com/images/"> [right](https://www.mindstick.com/articles/12766/check-whether-you-are-doing-digital-transformation-right-or-not) after.\
How do I do this in C#.\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!Any help will be appreciated!

## Replies

### Reply by AVADHESH PATEL

Hi Ankit!\
You can just do something as following\
myHtmlString.Replace("<head>", "<head><base href=\"http://www.mindstick.com/images/\">");\
Not the most elegant or expandable, but satisfies the conditions of your question.


---

Original Source: https://www.mindstick.com/forum/875/add-string-after-a-specified-string

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
