惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Vulnerabilities – Threatpost
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Blog — PlanetScale
Blog — PlanetScale
aimingoo的专栏
aimingoo的专栏
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
V
Visual Studio Blog
F
Fortinet All Blogs
C
CERT Recently Published Vulnerability Notes
Spread Privacy
Spread Privacy
月光博客
月光博客
L
LINUX DO - 热门话题
C
Cisco Blogs
P
Proofpoint News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
爱范儿
爱范儿
B
Blog
P
Privacy International News Feed
Know Your Adversary
Know Your Adversary
The Cloudflare Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Cyberwarzone
Cyberwarzone
J
Java Code Geeks
罗磊的独立博客
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Cisco Talos Blog
Cisco Talos Blog
T
Tor Project blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 司徒正美
酷 壳 – CoolShell
酷 壳 – CoolShell
Simon Willison's Weblog
Simon Willison's Weblog
量子位
H
Help Net Security
The Register - Security
The Register - Security
L
LangChain Blog
GbyAI
GbyAI
Vercel News
Vercel News
S
Schneier on Security
T
Threatpost
T
Threat Research - Cisco Blogs
有赞技术团队
有赞技术团队
Y
Y Combinator Blog
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog
MongoDB | Blog
MongoDB | Blog
Recorded Future
Recorded Future
G
GRAHAM CLULEY
MyScale Blog
MyScale Blog

博客园 - 但用此心

在CentOS中使用 yum 安装MongoDB及服务器端配置 yum安装mongodb 不错的文章 windows 下,go语言 交叉编译 linux 下 安装go go http 文件下载 go练习5--生成md5 go练习4--json 序列号反序列化 go练习3 --map的操作 go练习2-go的学习资料 php 定界符 mysql 修改默认配置 提高性能 eclipse 的代码着色插件 --Eclipse Color Theme 将tomcat添加为linux系统服务 在centos linux上安装jdk7 使用excel 展现数据库内容 java 查看线程死锁 linux 配置 java 环境变量 win7 安装windows 服务 报错 System.Security.SecurityException 解决方法 An exception occurred during the Install phase. System.Security.SecurityException: The so
go练习1-翻转字符串
但用此心 · 2014-09-12 · via 博客园 - 但用此心
//翻转字符串

func T1_1() {

	str := "你好helloworld!"
	fmt.Println("翻转前", str)
	var ret string
	for _, v := range str { //_ 占位使用
		ret = string(v) + ret
	}
	fmt.Println("翻转后", ret)
}

func T1_2() {
	str := "你好!go"
	fmt.Println("翻转前", str)
	tmp := []rune(str)
	strLen := len(tmp)
	ret := make([]rune, strLen)

	for i := 0; i < strLen; i++ {
		ret[i] = tmp[strLen-i-1]
	}
	fmt.Println("翻转后", string(ret))
}

func T1_3() {
	str := "你好!go"
	fmt.Println("翻转前", str)
	tmp := []rune(str)
	var ret string
	for i, j := 0, len(tmp)-1; i < j; i, j = i+1, j-1 {
		tmp[i], tmp[j] = tmp[j], tmp[i]
	}
	ret = string(tmp)
	fmt.Println("翻转后", ret)
}

  个人觉得第三种方法最优雅