package main

import (
"fmt"
s "strings"
) var p = fmt.Println func main() {
//strings标准库包含的函数
p("Contains: ", s.Contains("test", "es"))
p("Count:", s.Count("test", "t"))
p("HasPrefix", s.HasPrefix("test", "te"))
p("HasSuffix", s.HasSuffix("test", "st"))
p("Index", s.Index("test", "e"))
p("Join", s.Join([]string{"a", "b"}, "-"))
p("Repeat", s.Repeat("a", 5))
p("Replace", s.Replace("foo", "o", "0", -1))
p("Replace", s.Replace("foo", "o", "0", 1))
p("Split", s.Split("a-b-c-d-e", "-"))
p("ToLower", s.ToLower("TESt"))
p("ToUpper", s.ToUpper("teSt"))
p()
p("Len:", len("hello"))
p("Char", "hello"[1])
}

Go Example--strings的更多相关文章

  1. Hacker Rank: Two Strings - thinking in C# 15+ ways

    March 18, 2016 Problem statement: https://www.hackerrank.com/challenges/two-strings/submissions/code ...

  2. StackOverFlow排错翻译 - Python字符串替换: How do I replace everything between two strings without replacing the strings?

    StackOverFlow排错翻译 - Python字符串替换: How do I replace everything between two strings without replacing t ...

  3. Multiply Strings

    Given two numbers represented as strings, return multiplication of the numbers as a string. Note: Th ...

  4. [LeetCode] Add Strings 字符串相加

    Given two non-negative numbers num1 and num2 represented as string, return the sum of num1 and num2. ...

  5. [LeetCode] Encode and Decode Strings 加码解码字符串

    Design an algorithm to encode a list of strings to a string. The encoded string is then sent over th ...

  6. [LeetCode] Group Shifted Strings 群组偏移字符串

    Given a string, we can "shift" each of its letter to its successive letter, for example: & ...

  7. [LeetCode] Isomorphic Strings 同构字符串

    Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the chara ...

  8. [LeetCode] Multiply Strings 字符串相乘

    Given two numbers represented as strings, return multiplication of the numbers as a string. Note: Th ...

  9. 使用strings查看二进制文件中的字符串

    使用strings查看二进制文件中的字符串 今天介绍的这个小工具叫做strings,它实现功能很简单,就是找出文件内容中的可打印字符串.所谓可打印字符串的涵义是,它的组成部分都是可打印字符,并且以nu ...

  10. LeetCode 205 Isomorphic Strings

    Problem: Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if ...

随机推荐

  1. websocket是如何进行建立连接与通信的?(简单理解)

    握手过程: websocket-client端通过ws协议向websocket-server端发起连接请求前,首先在自己的请求头中添加Sec-Websocket-Key键值对,值为根据自己账号通过一定 ...

  2. 谈谈如何给下拉框option添加点击事件?

    我们在用到下拉列表框select时,需要对选中的<option>选项触发事件,其实<option>本身没有触发事件方法,我们只有在select里的onchange方法里触发. ...

  3. Python- - -基础目录

    一.Python.pycharm的介绍与安装. 二.变量.整数.字符串.列表.字典.集合. 三.运算符.格式化输出.流程控制语句. 四.break和continue. 五.range.enumerat ...

  4. ES6学习笔记(二)—— 通过ES6 Module看import和require区别

    前言 说到import和require,大家平时开发中一定不少见,尤其是需要前端工程化的项目现在都已经离不开node了,在node环境下这两者都是大量存在的,大体上来说他们都是为了实现JS代码的模块化 ...

  5. nisght heap increase

    sudo gedit /usr/local/cuda-5.5/libnsight/nsight.ini --launcher.defaultActionopenFile-vm../jre/bin/ja ...

  6. learning gcc args

    参数详解无选项编译链接    将test.c预处理.汇编.编译并链接形成可执行文件.这里未指定输出文件,默认输出为a.out.    例子用法:    gcc test.c 无选项链接    gcc ...

  7. day12_python_1124

    00 如何学习python 如何学好英语? 母系英语. 听 说 读 写 练 input output 听 说 读 写(练) 听,读 说 纠正 01 昨日内容回顾 生成器:本质就是迭代器,自己用pyth ...

  8. SQL DELETE 语句详解

    SQL DELETE 语句详解   DELETE 语句 DELETE 语句用于删除表中的行. 语法 DELETE FROM 表名称 WHERE 列名称 = 值 Person: LastName Fir ...

  9. Android 音视频深入 十四 FFmpeg与OpenSL ES 播放mp3音乐,能暂停(附源码下载)

    项目地址https://github.com/979451341/FFmpegOpenslES 这次说的是FFmpeg解码mp3,数据给OpenSL ES播放,并且能够暂停. 1.创建引擎 slCre ...

  10. CCF关于NOIP竞赛程序提交的管理规则

    在NOIP复赛中,NOI各省组织单位必须严格遵循CCF<关于NOIP数据提交格式的说明>的规范在竞赛结束后规定时间内向CCF提交本赛区所有参赛选手的程序. 为竞赛的公平以及赛后按时完成竞赛 ...