csharp进阶练习题:字符串转换为骆驼【难度:2级】:
完成方法/函数,以便它破折号/下划线分隔的单词转换成骆驼套管.输出中的第一个字应该大写** ** 仅如果原始字被大写(称为上部驼峰,也通常被称为帕斯卡情况).
例子
toCamelCase(下称"隐形战士"); //返回 "theStealthWarrior"
toCamelCase( "The_Stealth_Warrior"); //返回 "TheStealthWarrior"
- 1
- 2
- 3
- 4
objc
toCamelCase(@"的隐形战士"); // => @ "theStealthWarrior"
toCamelCase(@ "The_Stealth_Warrior"); // => @ "TheStealthWarrior"
- 1
- 2
- 3
- 4
- 5
toCamelCase(下称"隐形战士")//返回"theStealthWarrior"
toCamelCase( "The_Stealth_Warrior")//返回 "TheStealthWarrior"
- 1
- 2
- 3
- 4
toCamelCase(下称"隐形战士")# 返回"theStealthWarrior"
toCamelCase( "The_Stealth_Warrior")# 返回 "TheStealthWarrior"
- 1
- 2
- 3
- 4
to_camel_case(下称"隐形战士")# 返回"theStealthWarrior"
to_camel_case( "The_Stealth_Warrior")# 返回 "TheStealthWarrior"
- 1
- 2
- 3
- 4
to_camel_case(下称"隐形战士")# 返回"theStealthWarrior"
to_camel_case( "The_Stealth_Warrior")# 返回 "TheStealthWarrior"
- 1
- 2
- 3
- 4
to_camel_case(下称"隐形战士")# 返回"theStealthWarrior"
to_camel_case( "The_Stealth_Warrior")# 返回 "TheStealthWarrior"
- 1
- 2
- 3
- 4
toCamelCase的"隐形战士" - 返回"theStealthWarrior"
toCamelCase "The_Stealth_Warrior" - 返回 "TheStealthWarrior"
- 1
- 2
- 3
- 4
Kata.ToCamelCase(下称"隐形战士")//返回"theStealthWarrior"
Kata.ToCamelCase( "The_Stealth_Warrior")//返回 "TheStealthWarrior"
- 1
- 2
- 3
- 4
to_camel_case(下称"隐形战士")//返回"theStealthWarrior"
to_camel_case( "The_Stealth_Warrior")//返回 "TheStealthWarrior"
- 1
- 2
- 3
- 4
to_camel_case(下称"隐形战士")# 返回"theStealthWarrior"
to_camel_case( "The_Stealth_Warrior")# 返回 "TheStealthWarrior"
to_camel_case( "混合separator_example")# 返回 "mixedSeparatorExample"
- 1
- 2
- 3
- 4
- 5
- 6
去
ToCamelCase(下称"隐形战士"); //返回 "theStealthWarrior"
ToCamelCase( "The_Stealth_Warrior"); //返回 "TheStealthWarrior"
- 1
- 2
- 3
- 4
- 5
tocamelcase(下称"隐形战士")# 返回"theStealthWarrior"
tocamelcase( "The_Stealth_Warrior")# 返回 "TheStealthWarrior"
- 1
- 2
- 3
toCamelCase(下称"隐形战士")//返回"theStealthWarrior"
toCamelCase( "The_Stealth_Warrior")//返回 "TheStealthWarrior"
- 1
- 2
- 3
- 4
编程目标:
using System;
public class Kata
{
public static string ToCamelCase(string str)
{
return str;
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
测试样例:
using System;
using NUnit.Framework;
[TestFixture]
public class KataTest
{
[Test]
public void KataTests()
{
.(, .(), "('the_stealth_warrior') did not return correct value");
Assert.AreEqual("TheStealthWarrior", Kata.ToCamelCase("The-Stealth-Warrior"), "('The-Stealth-Warrior') did not return correct value");
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
最佳答案(多种解法):
点击查看答案
更多关联题目:
免责申明
本博客所有编程题目及答案均收集自互联网,主要用于供网友学习参考,如有侵犯你的权益请联系管理员及时删除,谢谢
题目收集至/
/kata/convert-string-to-camel-case