Click here to Skip to main content
14,825,860 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a string like
Centurylink@9-Transportation@5-Next-Gen ADM Services@6-Next-Gen ADM@7-C1@9-2020@


I want to remove @ and next character after @


result
Centurylink-Transportation-Next-Gen ADM Services-Next-Gen ADM-C1-2020


What I have tried:

I have tried using index and last index which not worked
Posted
Updated 12-Nov-20 0:15am
Comments
PIEBALDconsult 12-Nov-20 10:52am
   
Definitely Regular Expressions.

1 solution

What about Regex?

C#
string initial = @"Centurylink@9-Transportation@5-Next-Gen ADM Services@6-Next-Gen ADM@7-C1@9-2020@";
string pattern = @"\@\d|\@";
Regex r = new Regex(pattern);
string result = r.Replace(initial, "");
Console.WriteLine(result);
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900