Skip to content

Commit 1238a7c

Browse files
committed
Change switch to if-else in Text2Txt of scs
1 parent 51695c0 commit 1238a7c

1 file changed

Lines changed: 17 additions & 32 deletions

File tree

dotnet_3/cs/rest/SCS/Imp/Text2Txt.cs

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,26 @@
1-
namespace SCS.Imp
2-
{
3-
public class Text2Txt
4-
{
5-
public static string Subject(string word1, string word2, string word3)
6-
{
1+
namespace SCS.Imp {
2+
public class Text2Txt {
3+
public static string Subject(string word1, string word2, string word3) {
74
//CONVERT ENGLISH TEXT txt INTO MOBILE TELEPHONE TXT
85
//BY SUBSTITUTING ABBREVIATIONS FOR COMMON WORDS
96
word1 = word1.ToLower();
107
word2 = word2.ToLower();
118
word3 = word3.ToLower();
129
var result = "";
13-
14-
switch (word1)
15-
{
16-
case "two":
17-
result = "2";
18-
break;
19-
case "for":
20-
case "four":
21-
result = "4";
22-
break;
23-
case "you":
24-
result = "u";
25-
break;
26-
case "and":
27-
result = "n";
28-
break;
29-
case "are":
30-
result = "r";
31-
break;
32-
case "see" when word2.Equals("you"):
33-
result = "cu";
34-
break;
35-
case "by" when word2.Equals("the") && word3.Equals("way"):
36-
result = "btw";
37-
break;
38-
}
10+
11+
if (word1.Equals("two"))
12+
result = "2";
13+
else if (word1.Equals("for") || word1.Equals("four"))
14+
result = "4";
15+
else if (word1.Equals("you"))
16+
result = "u";
17+
else if (word1.Equals("and"))
18+
result = "n";
19+
else if (word1.Equals("are"))
20+
result = "r";
21+
else if (word1.Equals("see") && word2.Equals("you"))
22+
result = "cu";
23+
else if (word1.Equals("by") && (word2.Equals("the") && word3.Equals("way"))) result = "btw";
3924

4025
return result;
4126
}

0 commit comments

Comments
 (0)