Your code only works when the first character is ASCII. For example, it 
does not work for the Greek alphabet, it does not work for an empty string.

https://play.golang.org/p/FQgnWfZqnrO

Peter

On Sunday, May 31, 2020 at 5:57:07 PM UTC-4, jyoti...@gmail.com wrote:
>
> I came up with this:
>
> package main
>
> import (
> "fmt"
> "strings"
> )
>
> func main() {
> fmt.Println(MakeFirstLowerCase("LikeThis"))
> }
>
> func MakeFirstLowerCase(s string) string {
>     
> s=strings.ToLower(string(s[0]))+s[1:]
> return s
> }
>
> On Saturday, November 24, 2012 at 4:21:23 PM UTC+5:30, Nikolai wrote:
>>
>> Hi!
>>
>> What is the easiest way to make a string "LikeThis" --> "likeThis"?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/d587139f-cd0a-4bed-a209-8231d2e93b5b%40googlegroups.com.

Reply via email to