字符串处理 字符串在开发中经常用到,包括用户的输入,数据库读取的数据等,我们经常需要对字符串进行分割、连接、转换等操作 字符串操作 下面这些函数来自于strings包,这里介绍一些我平常经常用到的函数,更详细的请参考官方的文档。 1.前缀和后缀 HasPrefix 判断字符串s是否以prefix开头 ...
分类:
其他好文 时间:
2019-09-20 23:19:43
阅读次数:
98
Given an array of strings, group anagrams together. Example: 题意: 给定一堆单词,把变位词放一块儿去。 碎碎念: 开始想说“eat” 转charArray {'e', 'a', 't'} “tea” 转charArray {'t', 'e ...
分类:
其他好文 时间:
2019-09-12 09:21:57
阅读次数:
75
Two strings are anagrams if they are permutations of each other. For example, "aaagmnrs" is an anagram of "anagrams". Given an array of strings, remov ...
分类:
其他好文 时间:
2019-09-12 09:19:34
阅读次数:
167
Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of b ...
分类:
其他好文 时间:
2019-09-11 11:53:03
阅读次数:
107
```golang //原文链接:https://www.jianshu.com/p/a0569157c418 golang mysql拼接子查询 使用fmt.Sprintf拼接SQL 实例代码 func Select(ids []string) string { idStr := strings.... ...
分类:
数据库 时间:
2019-09-10 18:03:05
阅读次数:
126
1、使用 const 关键字来声明某个常量字段或常量局部变量。常量字段和常量局部变量不是变量并且不能修改。 常量可以为数字、布尔值、字符串或 null 引用(Constants can be numbers, Boolean values, strings, or a null reference) ...
分类:
其他好文 时间:
2019-09-10 17:51:55
阅读次数:
67
Decoder: python package main import ( "encoding/json" "fmt" "io" "log" "strings" ) func main ( ) { const jsonStream = ` { "Name" : "Ed" , "Text" : "Kn ...
分类:
Web程序 时间:
2019-09-10 17:37:20
阅读次数:
134
题目链接: http://codeforces.com/gym/101161/attachments 题意: 数据范围: 分析: ac代码: ...
分类:
其他好文 时间:
2019-09-09 19:17:51
阅读次数:
58
使用名字空间成员的简单方法: using namespace ::name;例如:using std::cin; 头文件不应包含using声明 标准库类型string:(需要带有头文件#include<string>) string对象的初始化方式: string s1;(默认空字符串) strin ...
分类:
编程语言 时间:
2019-09-08 22:36:14
阅读次数:
116
"题目链接" 问题分析 由于三个字母是等价的,所以大致可以分为如下几种情况: aa, ab ab, ac ab, ba ab, bc 不难发现,第$3$中情况可能造成无解($n 1$时),而剩下的情况都可以由$aaabbbccc$或$abcabcabc$这样的串解决。所以直接枚举$3$个字母的全排列 ...
分类:
其他好文 时间:
2019-09-07 10:21:11
阅读次数:
60