-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToggleArray.cs
38 lines (36 loc) · 1021 Bytes
/
ToggleArray.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.Text;
namespace SkillMineProject.Array
{
class ToggleArray
{
public char[] chengeArray(char[]ch)
{
for (int i = 0; i < ch.Length; i++)
{
if(ch[i]>='a' && ch[i]<='z')
{
ch[i] = (char)(ch[i] - 32);
}
else if(ch[i]>='A' && ch[i]<='Z')
{
ch[i] = (char)(ch[i] + 32);
}
else
{
ch[i] = ch[i];
}
}
return ch;
}
static void Main(string[] args)
{
char[] c = { 't', 'R', 'U', 'a', 'l' };
Console.WriteLine(string.Join(" ", c));
ToggleArray t = new ToggleArray();
char[] mytoggle = t.chengeArray(c);
Console.WriteLine(string.Join(" ", mytoggle));
}
}
}