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 ...
随机推荐
- (原)caffe中通过图像生成lmdb格式的数据
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5909121.html 参考网址: http://www.cnblogs.com/wangxiaocvp ...
- iOS UIWebView 访问https 绕过证书验证的方法
在文件开始实现 allowsAnyHTTPSCertificateForHost 方法 @implementation NSURLRequest (NSURLRequestWithIgnoreSSL ...
- mysql install
./scripts/mysql_install_db --user=mahao01 --basedir=/home/mahao01/local/mysql --datadir=/home/mahao0 ...
- R语言学习笔记(数据的读取与保存)
library(MASS)#载入package MASSdata(package="MASS") #查看MASS中的数据集data(SP500,package="MASS ...
- CentOS 安装redis2.8.13 提醒"libc.so.6: version `GLIBC_2.14' not found"系统的glibc版本太低
以下在系统CentOS 6.3 x86_64上操作 1.试图运行程序,提示"libc.so.6: version `GLIBC_2.14' not found",原因是系统的gli ...
- tuple只有一个元素的时候,必须要加逗号
In [1]: a = (1) In [2]: a Out[2]: 1 In [3]: a = (1,) In [4]: a Out[4]: (1,) 这是因为括号()既可以表示tuple,又可以表示 ...
- Html 编码 queryUrl = encodeURI(queryUrl);
Html 编码 queryUrl = encodeURI(queryUrl);
- MVC4商城项目三:分部视图在导航条上的应用
写了几天发觉大部分时间用在JS上了,本来想写个musicstore,却加了框架,然后又想用后台,然后又想用上bootstrapt,然后又想弄权限设计,然后又想………… 看来是想多了~ 好吧,最近把后台 ...
- information_schema.optimizer_trace学习
information_schema.optimizer_trace 用于追踪优化器的优化过程:通常来说这张表中是没有数据的,要想开户追踪要把 @@session.optimizer_trace='e ...
- USB CCID "复杂"命令拾零?
本文记录 USB CCID 标准中几个"复杂"的命令,复杂在于在这些命令身上花的时间较之简单的命令多许多或者是理解的时间比较晚,可能就是刚才.主要有以下几条:ccid_T0APDU ...