---
title: "How can I format a string?"  
description: "How can I format a string?"  
author: "marcel ethan"  
published: 2013-11-14  
updated: 2013-11-14  
canonical: https://www.mindstick.com/forum/1725/how-can-i-format-a-string  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How can I format a string?

My string looks like 0145655789, I want to change its format to 0145.655.789

This is the [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) I tried:

enterpriseCode.Append([String.Format](https://www.mindstick.com/forum/1763/string-format-with-null-values-c-sharp)("{0:####.###.###}", aNum.ToString()).Replace(";", ""));

But it [giving](https://yourviews.mindstick.com/view/80639/regifting-is-far-better-than-giving-away-a-bouquet) me same string, not giving me desired string.

How to do it?

## Replies

### Reply by Pravesh Singh

Hi marcel,

You can try this:-

[string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) formatted = enterpriseCode.Insert(4, ".").Insert(8, ".");

Hope this will solve your problem.


---

Original Source: https://www.mindstick.com/forum/1725/how-can-i-format-a-string

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
