Memory Efficiency and Performance of String.Replace .NET Framework

前端 未结 10 1280
天命终不由人
天命终不由人 2020-11-27 16:50
 string str1 = \"12345ABC...\\\\...ABC100000\"; 
 // Hypothetically huge string of 100000 + Unicode Chars
 str1 = str1.Replace(\"1\", string.Empty);
 str1 = str1.Rep         


        
10条回答
  •  [愿得一人]
    2020-11-27 17:00

    if you want a built in class in dotnet i think StringBuilder is the best. to make it manully you can use unsafe code with char* and iterate through your string and replace based on your criteria

提交回复
热议问题