golang make the first character in a string lowercase/uppercase
import (
"unicode"
)
func UcFirst(str string) string {
for i, v := range str {
return string(unicode.ToUpper(v)) + str[i+1:]
}
return ""
} func LcFirst(str string) string {
for i, v := range str {
return string(unicode.ToLower(v)) + str[i+1:]
}
return ""
}
golang make the first character in a string lowercase/uppercase的更多相关文章
- 209. First Unique Character in a String
Description Find the first unique character in a given string. You can assume that there is at least ...
- PHP icov转码报错解决方法,iconv(): Detected an illegal character in input string
iconv(): Detected an illegal character in input string 错误解决方法 //转码 function iconv_gbk_to_uft8($strin ...
- LeetCode_387. First Unique Character in a String
387. First Unique Character in a String Easy Given a string, find the first non-repeating character ...
- PHP出现iconv(): Detected an illegal character in input string
PHP传给JS字符串用ecsape转换加到url里,又用PHP接收,再用网上找的unscape函数转换一下,这样得到的字符串是UTF-8的,但我需要的是GB2312,于是用iconv转换 开始是这样用 ...
- [LeetCode] First Unique Character in a String 字符串第一个不同字符
Given a string, find the first non-repeating character in it and return it's index. If it doesn't ex ...
- 387. First Unique Character in a String
Given a string, find the first non-repeating character in it and return it's index. If it doesn't ex ...
- LeetCode 387. First Unique Character in a String
Problem: Given a string, find the first non-repeating character in it and return it's index. If it d ...
- LeetCode First Unique Character in a String
原题链接在这里:https://leetcode.com/problems/first-unique-character-in-a-string/ 题目: Given a string, find t ...
- leetcode修炼之路——387. First Unique Character in a String
最近公司搬家了,有两天没写了,今天闲下来了,继续开始算法之路. leetcode的题目如下: Given a string, find the first non-repeating characte ...
随机推荐
- js 之 Post发送请求
// ajax 对象 function ajaxObject() { var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp = new X ...
- Unity-视图
Project(项目)视图:显示项目所包含的全部资源,每个Unity项目文件夹都会包含一个Assets文件夹,Assets文件夹是用来存放用户所创建的对象和导入的资源. Hierarchy(层级)视图 ...
- 把EXCEL列号数字变成字母
把Excel 列号数字变成字母 private static string ToName(int index) { if (index < 0) { throw new Exception(&q ...
- css3实现手机qq空间菜单按钮
工作之余写的一个类似于QQzone的菜单效果 先上截图: 图一为点击按钮前界面: 图二为点击按钮后的界面 下面上代码: <!--css部分--> <style type=" ...
- .net项目IIS、VS 附加进程调试
IIS调试 1.首先要把项目发布至IIS上,确保项目能正常运行. 2.从IIS上右键站点>管理网站>浏览 或者打开“内容视图“ 选择一个文件右键>浏览. 3.用vs打开该项目,选择 ...
- 一个简单的网页读字符串 SpeechLib
//引用组件:Interop.SpeechLib.dll//导入空间:SpeechLib //引用组件:Interop.SpeechLib.dll//导入空间:SpeechLib 前面设置内容引用别人 ...
- checkbox选中问题
<head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312&qu ...
- android继续学习相关
最近不是很忙,但是慢慢就忘记了学习. 我总是选中了一条路后,怀疑它的正确性.我也知道这不好. 一年前,我买了一个ipad,然后玩app上的游戏,觉得很好玩,而且上面很多都是收费的, 当时就觉得,为什么 ...
- g++ error: extra qualification on member [-fpermissive]
以下这段代码是在头文件里面的,DmaOpen DmaClose函数也是直接在class pcie_chip{}里面的.加了个额外的pcie_chip::才会报错. //delete pcie_chip ...
- 2014.8.3情人节欢乐赛【Benny的农场】
Benny的农场 (farm.pas/.c/.cpp) 时间限制:1s.空间限制:128MB 题目描述: Benny有一片农田需要灌溉.农田的形状为矩形,并被分为许多小块.每一块中都有一些水管.共有1 ...