+ 1
I duno why i will get infinite loop like tis in c#. Pls Help!
does anyone know why my tis code get infinite loop? and Char.IsUpper is not exactly run wat i think or i use it wrong? https://code.sololearn.com/cVnmR1XN10F3 when take out the for loop it has no problem. https://code.sololearn.com/c3eNqkaDBYqu
3 Answers
+ 4
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SoloLearn
{
class Program
{
static void Main(string[] args)
{
string x = "someCase";
int y =x.Length ;
for(int i=0; i<y; i++)
{
if(Char.IsUpper(x,i));
{
x = x.Insert(i,"_");
}
Console.WriteLine(x);
}
}
}
}
+ 4
Every time you inserted a '_' it modified the character size of the string
0
thx. i think i know wat u mean.
but i stil dun get it why i insert '_' is not at previous capital letter? but it shows at 1st index?
EDIT: i found the mistake d. thx for the help