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

推荐订阅源

Google DeepMind News
Google DeepMind News
S
Secure Thoughts
Application and Cybersecurity Blog
Application and Cybersecurity Blog
AWS News Blog
AWS News Blog
GbyAI
GbyAI
腾讯CDC
WordPress大学
WordPress大学
V
V2EX
小众软件
小众软件
C
CXSECURITY Database RSS Feed - CXSecurity.com
M
MIT News - Artificial intelligence
T
Troy Hunt's Blog
H
Hacker News: Front Page
Scott Helme
Scott Helme
The Hacker News
The Hacker News
Schneier on Security
Schneier on Security
K
Kaspersky official blog
S
Security @ Cisco Blogs
N
News | PayPal Newsroom
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Threatpost
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Martin Fowler
Martin Fowler
P
Privacy International News Feed
Blog — PlanetScale
Blog — PlanetScale
D
DataBreaches.Net
O
OpenAI News
P
Proofpoint News Feed
J
Java Code Geeks
B
Blog RSS Feed
Attack and Defense Labs
Attack and Defense Labs
L
Lohrmann on Cybersecurity
T
Threat Research - Cisco Blogs
C
Cybersecurity and Infrastructure Security Agency CISA
阮一峰的网络日志
阮一峰的网络日志
P
Palo Alto Networks Blog
Engineering at Meta
Engineering at Meta
AI
AI
Google DeepMind News
Google DeepMind News
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
Simon Willison's Weblog
Simon Willison's Weblog
人人都是产品经理
人人都是产品经理
T
Tailwind CSS Blog
G
GRAHAM CLULEY
A
Arctic Wolf
N
Netflix TechBlog - Medium
L
LINUX DO - 最新话题
爱范儿
爱范儿
博客园 - 聂微东

博客园 - 但用此心

在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)
}

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