【问题标题】:Convert string in camelcase by using C#使用 C# 转换驼峰式字符串
【发布时间】:2023-02-20 22:32:56
【问题描述】:

使用下面的正则表达式将下面的 javascript 函数转换为 C#

`
const camelize = (str) => {
  return str.replace(/(?:^\w|[A-Z]|\b\w)/g, (word, index) => {
    return index === 0 ? word.toLowerCase() : word.toUpperCase();
  }).replace(/\s+/g, '');
}
console.log(camelize("EquipmentClass name"));
`

【问题讨论】:

  • 你有没有尝试过?

标签: c# regex camelcasing


【解决方案1】:

好吧,搜索空格,如果找到一个,获取下一个字符并尝试将其大写

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-03
    • 2011-02-27
    • 2015-07-07
    • 1970-01-01
    相关资源
    最近更新 更多