go程序设计语言第一章-入门
Go is a compiled language.
Go natively handles Unicode, so it can process text in all the world’s languages.
Exercis e 1.3: Experiment to measure the dif ference in running time bet ween our pot ent ial ly
inefficient versions and the one that uses strings.Join. (Section 1.6 illustrates par t of the
time package, and Sec tion 11.4 shows how to write benchmark tests for systematic performance evaluation.)
几个名为dup的程序,其来源为Unix的uniq命令。
bufio.Scanner客户方便、有效率地读取输入和输出。Scanner读取输入,将它拆分为行或单词。
input := bufio.NewScanner(os.Stdin)
每次调用input.Scan()读取下一行,从结束处删除新行的字符(什么含义?)。
格式化输出字符格式,称为verb:
%d de cimal integer
%x, %o, %b integer in hexade cimal, octal, binar y
%f, %g, %e floating-p oint number: 3.141593 3.141592653589793 3.141593e+00
%t boole an: true or false
%c rune (Unico de co de point)
%s st ring
%q quot ed str ing “abc” or rune ‘c’
%v any value in a natural format
%T type of any value
%% literal percent sig n (no operand)
\t \n等称为escape sequence,代表不可见字符。
常量的值必须为数字、字符串或布尔值。
A handler pattern that ends with a slash matches any URL that has the pattern asaprefix。
switch-case
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术