csharp basic exercises: the old switcheroo 2 [difficulty: Level 1] - view the C # programming classic exam, exercises of varying difficulty C #, C # novice suitable for self-study of advanced training

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_45444821/article/details/102714739

csharp basic exercises: the old switcheroo 2 [difficulty: Level 1]:

This is from my old switcheroo exercises

write

函数编码(STR)

DEF编码(STR)

DEF编码(STR)

编码=(STR) - >

公共静态字符串编码(字符串str)

This occurs when a string

海峡

And their respective positions in the English alphabet to replace all the letters.

编码("ABC")=="123" //一个是第一英语alpabet,b为第二和c是第三
编码( 'codewars')== '315452311819'
编码( 'ABC  -#@ 5')== '123  -#@ 5'

编码( 'ABC')== '123'#a是第一英语alpabet,b为第二和c是第三
编码( 'codewars')== '315452311819'
编码( 'ABC  -#@ 5')== '123  -#@ 5'

编码( 'ABC')== '123'#a是第一英语alpabet,b为第二和c是第三
编码( 'codewars')== '315452311819'
编码( 'ABC  -#@ 5')== '123  -#@ 5'

编码"ABC" =="123"#a是第一英语alpabet,b为第二和c是第三
编码 'codewars' == '315452311819'
编码 'ABC  -#@ 5' == '123  -#@ 5'

编码( "ABC")== "123" // a是第一英语alpabet,b为第二和c是第三
编码( "codewars")== "315452311819"
编码( "ABC  -#@ 5")== "123  -#@ 5"

The string is case-sensitive.

//奖金点,如果你不使用toLowerCase()

# 奖金点,如果你不使用toLowerCase()

//奖金点,如果你不使用ToLower将()

Programming objectives:

using System;
public class Kata
{
  public static string Encode(string str)
  {
  }
}


Test sample:

using System;
using NUnit.Framework;
[TestFixture]
public class Test
{
  [Test]
  [TestCase("abc", ExpectedResult="123")]
  [TestCase("ABCD", ExpectedResult="1234")]
  [TestCase("ZzzzZ", ExpectedResult="2626262626")]
  [(, ="208919 919 1 1215147 1920189147!! 161251195 [51431545] @30181853201225")]
  public static string FixedTest(string str)
  {
    return Kata.Encode(str);
  }
}


Best answer (multiple solutions):

Click to view answer

More related topics:

csharp basic exercises: Gets the length [of difficulty: Level 1] - view the C # programming classic exam, exercises of varying difficulty C #, C # novice suitable for self-study of advanced training

Disclaimer

This blog All programming topics and answers were collected from the Internet, users are mainly used for study and reference, if any violation of your rights, please contact the administrator to delete, thank
entitled to collect https://www.codewars.com/
HTTPS: / /www.codewars.com/kata/the-old-switcheroo-2

Guess you like

Origin blog.csdn.net/weixin_45444821/article/details/102714739