6.01- return false;
6.02 - string r = "";
for(int i = 0; i < s.Length ;i++){
if (i % 2 == 0){
r += s.Substring(i, 1).ToUpper();
}
else
r += s.Substring(i, 1);
}
return r;
6.03 - string r = "";
for(int i = 0, j = 1; i < s.Length; i++, j++){
if(i == s.Length - 1 || s[j] == ' ' ){
r += Char. ToUpper(s[i]);
}
else{
r += s[i];
}
}
return r;
6.04 - return s[x];
6.05 - return two + one;
6.06 - return s.Substring(s.Length/2);
6.07 - string r = "";
r = s.Substring((s.Length/2)+1).ToUpper();
r += s.Substring((s.Length /2));
return r;
6.08 - return Math.Max(b.Length, a.Length);
updated
6.09 - if(a.Length > b.Length){
return a;
}
if(b.Length > a.Length){
return b;
}
return a + b;
6.10 - return s.Length /3;
6.11- return s.Substring(i,s.Length-i-1) + s.Substring(s.Length-2,1);
Thanks to Araz
6.12 -string w = "";
char [] charArray = s.ToCharArray();
Array.Reverse( charArray );
w = new string( charArray );
return s+w;
6.11 = return s.Substring(i,s.Length-i-1) + s.Substring(j,s.Length-j-1);
ReplyDelete6.1 wtf?? :-/
ReplyDelete6.11 = return s.Substring(i,s.Length-i-1) + s.Substring(s.Length-2,1);
ReplyDelete6.02:
ReplyDeletechar[] c = s.ToCharArray();
for (int i = 0; i < c.Length; i += 2) {
c[i] = char.ToUpper(c[i]);
}
return new String(c);
6.08:
ReplyDeletereturn Math.Max(b.Length, a.Length);
or
return b.Length > a.Length ? b.Length : a.Length;
6.09
ReplyDeletereturn a.Length==b.Length?a+b:a.Length>b.Length?a:b;
6.03
ReplyDeletereturn Regex.Replace(s,@"\w\b",c => c.Value.ToUpper());