• 按键公众号 :
按键精灵电脑版
立即下载

软件版本:2014.06
软件大小:22.9M
更新时间:2021-12-03

按键精灵安卓版
立即下载

软件版本:3.7.2
软件大小:46.2M
更新时间:2023-05-10

按键精灵iOS版
立即下载

软件版本:1.8.0
软件大小:29.2M
更新时间:2023-03-21

按键手机助手
立即下载

软件版本:3.8.0
软件大小:262M
更新时间:2023-05-30

快捷导航

登录 后使用快捷导航
没有帐号? 注册

发新话题 回复该主题

[神梦] 【每日一题】单词首字母大写 - 2022.10.14 [复制链接]

1#
题目描述

给定一段英文文本(单词间都是空格分隔),请编写一个函数,将每个单词的首字母转成大写。

【示例】:
输入:"hello world"
输出:"Hello World"

题目难度:一般
题目交流: 584781753
  1. Import "SmAssert.dll"

  2. Function 单词首字母大写(英文文本)
  3.     // 您的代码写在这里
  4. End Function


  5. SmAssert 单词首字母大写("hello world") = "Hello World"
  6. SmAssert 单词首字母大写("knowledge is power") = "Knowledge Is Power"
  7. SmAssert 单词首字母大写("life is just passing travelers") = "Life Is Just Passing Travelers"
  8. SmAssert 单词首字母大写("the pain is forced to leave the place") = "The Pain Is Forced To Leave The Place"
  9. SmAssert 单词首字母大写("happiness is the desire to temporarily stop") = "Happiness Is The Desire To Temporarily Stop"
  10. SmAssert 单词首字母大写("the essence of life is movement, death is peaceful and quiet") = "The Essence Of Life Is Movement, Death Is Peaceful And Quiet"
复制代码

参考题解

  1. Import "SmAssert.dll"

  2. Function 单词首字母大写(英文文本)
  3.     
  4.     '【作者】:神梦无痕
  5.     '【QQ】:1042207232
  6.     '【Q群】:584781753
  7.     
  8.     Dim words, i
  9.     
  10.     words = Split(英文文本, " ")
  11.     For i = 0 To UBound(words)
  12.         words(i) = UCase(Left(words(i), 1)) & Mid(words(i), 2)
  13.     Next
  14.     单词首字母大写 = Join(words, " ")
  15. End Function


  16. SmAssert 单词首字母大写("hello world") = "Hello World"
  17. SmAssert 单词首字母大写("knowledge is power") = "Knowledge Is Power"
  18. SmAssert 单词首字母大写("life is just passing travelers") = "Life Is Just Passing Travelers"
  19. SmAssert 单词首字母大写("the pain is forced to leave the place") = "The Pain Is Forced To Leave The Place"
  20. SmAssert 单词首字母大写("happiness is the desire to temporarily stop") = "Happiness Is The Desire To Temporarily Stop"
  21. SmAssert 单词首字母大写("the essence of life is movement, death is peaceful and quiet") = "The Essence Of Life Is Movement, Death Is Peaceful And Quiet"
复制代码










插件下载

 
【插件】神梦断言插件 SmAssert.dll,帮助开发者发现业务逻辑错误

2#

111111111111111111111

3#

我猜,是读取文本信息,分隔符是空格来把单词分割成数组,然后mid函数取数组每个成员第一个字符,然后调用插件识别并替换,然后再写入文本

承接游戏自动化\excel办公自动化\网页批量自动化\网络协议批量自动化定制
发新话题 回复该主题