csharp basic exercises: [name of the array matrix Capping 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/102733177

csharp basic exercises: [name of the array matrix Capping difficulty: Level 1]:

Create an accepted name of the array, and returns its initials array matrix for each name of the method.

Case

cap_me([ 'JO', '纳尔逊', 'jurie'])# 返回[ '乔', '纳尔逊', 'Jurie']
cap_me([ 'KARLY', 'DANIEL', 'KELSEY'])# 返回[ 'Karly', '丹尼尔', '凯尔']

capMe([ 'JO', '纳尔逊', 'jurie'])//返回[ '乔', '纳尔逊', 'Jurie']
capMe([ 'KARLY', 'DANIEL', 'KELSEY'])//返回[ 'Karly', '丹尼尔', '凯尔']

capMe [ "乔", "尼尔森", "jurie"]`shouldBe` [ "乔", "纳尔逊", "Jurie"]
capMe [ "JO", "NELSON", "JURIE"]`shouldBe` [ "乔", "纳尔逊", "Jurie"]

Kata.CapMe(新的字符串[] { "乔", "尼尔森", "jurie"})=>新的字符串[] { "乔", "尼尔森", "Jurie"}
Kata.CapMe(新的字符串[] { "KARLY", "DANIEL", "KELSEY"})=>新的字符串[] { "Karly", "丹尼尔", "凯尔"}

Kata.capMe(新的String [] { "乔", "尼尔森", "jurie"})//返回新的String [] { "乔", "尼尔森", "Jurie"}
Kata.capMe(新的String [] { "KARLY", "DANIEL", "KELSEY"})//返回新的String [] { "Karly", "丹尼尔", "凯尔"}

Programming objectives:

using System;
public static class Kata
{
  public static string[] CapMe(string[] strings)
  {
    throw new NotImplementedException();
  }
}


Test sample:

namespace Solution 
{
  using NUnit.Framework;
  using System;
  [TestFixture]
  public class SolutionTest
  {
    public void SampleTest()
    {
      Assert.AreEqual(new string[] {"expected"}, Kata.CapMe(new string[] {"ExPeCteD"}));
    }
  }
}


Best answer (multiple solutions):

Click to view answer

More related topics:

csharp basic exercises: Counting like a child [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/name-array-capping

Guess you like

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