Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,152 questions

40,706 answers

573 users

How to lowercase a single byte from a slice of bytes in Go

1 Answer

0 votes
package main
 
import (
    "fmt"
    "unicode"
)
 
func main() {
   slice := []byte{'G', 'O', ' ' , '1', '.', '1', '4', '.', '2'} 
   
   pos := 0      
   slice[pos] = byte(unicode.ToLower(rune(slice[pos])))
 
   fmt.Printf("%s", slice) 
}
 
 
 
/*
run:
 
gO 1.14.2
 
*/

 





answered May 24, 2020 by avibootz
edited May 24, 2020 by avibootz

Related questions

1 answer 64 views
1 answer 120 views
2 answers 81 views
2 answers 83 views
4 answers 131 views
...