Answers for "modificare una strinfa in c#"

C#
0

modificare una strinfa in c#

string phrase = "The quick brown fox jumps over the fence";
Console.WriteLine(phrase);

char[] phraseAsChars = phrase.ToCharArray();
int animalIndex = phrase.IndexOf("fox");
if (animalIndex != -1)
{
    phraseAsChars[animalIndex++] = 'c';
    phraseAsChars[animalIndex++] = 'a';
    phraseAsChars[animalIndex] = 't';
}

string updatedPhrase = new string(phraseAsChars);
Console.WriteLine(updatedPhrase);
Posted by: Guest on April-11-2020

Code answers related to "modificare una strinfa in c#"

C# Answers by Framework

Browse Popular Code Answers by Language