Home > Net >  Judgment for loop of string before and after the two values are equal
Judgment for loop of string before and after the two values are equal

Time:05-28


Public static void Main ()
{
String a="? Zs ";
Console. WriteLine (ModifyString (a));
The Console. ReadKey ();
}
Public static string ModifyString (string s)
{

The Random rd=new Random ();
Int shu=rd. Next (97, 122);
Char c=(char) shu;
for (int i=0; I & lt; S.L ength; I++)
{
If (s [I]! [I=s + 1] & amp; & S [I]=='? ')
{
[I] s=s.R eplace (s, c);
}
}
Return s;
}


Basically see s [I]!=s + 1] [I, I wrote this problem is beyond boundaries, how to change, let him determine if two values are equal before and after ~

CodePudding user response:

for (int i=0; I & lt; S.L ength; I +=2)
  •  Tags:  
  • C#
  • Related