mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 16:54:50 +08:00
Update kama54.替换数字.md
This commit is contained in:
@ -162,6 +162,27 @@ class Main {
|
||||
```
|
||||
|
||||
### Go:
|
||||
````go
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main(){
|
||||
var strByte []byte
|
||||
|
||||
fmt.Scanln(&strByte)
|
||||
|
||||
for i := 0; i < len(strByte); i++{
|
||||
if strByte[i] <= '9' && strByte[i] >= '0' {
|
||||
inserElement := []byte{'n','u','m','b','e','r'}
|
||||
strByte = append(strByte[:i], append(inserElement, strByte[i+1:]...)...)
|
||||
i = i + len(inserElement) -1
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf(string(strByte))
|
||||
}
|
||||
````
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user