command
Version:
v0.0.0-...-afccd23
Opens a new window with list of versions in this module.
Published: May 17, 2024
License: GPL-2.0
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
字符串替换问题
问题描述
请编写一个方法,将字符串中的空格全部替换为“%20”。
假定该字符串有足够的空间存放新增的字符,并且知道字符串的真实长度(小于等于1000),同时保证字符串由【大小写的英文字母组成】。
给定一个string为原始的串,返回替换后的string。
解题思路
两个问题,第一个是只能是英文字母,第二个是替换空格。
源码参考
源码
源码解析
这里使用了golang内置方法unicode.IsLetter
判断字符是否是字母,之后使用strings.Replace
来替换空格。
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.