We help IT Professionals succeed at work.
Get Started

File naming function in c#

Last Modified: 2016-02-11
I would like to make a function that takes two strings passed to it and renames it and passes that new name back.
the input strings it will get will be

parameter 1 in "region 1" or "region 2" or "region 3"
parameter 2 in "originalfilename" an ex: "UNArpC1C6A03"

in the filename the c1c6 is constant but text to left and right of that will change

 "region 1" then output becomes "UNArpC1C2A03"
 "region 2" then output becomes "UNArpC3C4A03"
 "region 3" then output becomes "UNArpC5C6A03"


so another example I pass
"Region 1" and original filename "UNLeadC1C6A101"

will output "UNLeadC1C2A101

"region 2", "UNLeadC1C6A101"
will output "UNLeadC3C4A101"

"region 3", "UNLeadC1C6A101"

will output "UNLeadC5C6A101"

I dont know C# so dont know how to start this
Watch Question
Distinguished Expert 2017
This problem has been solved!
Unlock 3 Answers and 13 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE