Hi, I have this method: func CallBack(key *C.char, value *C.char, value_len C.size_t){
} and the *value* parameter in the arguments is containing the given string 'Fp5PpR2roT6uPnte47 image/gif'. I want to extract only first word from the string.Let me know how can I do this. I don't want to split the string into a slice of individual characters. Thanks On Wed, May 1, 2019 at 6:27 AM Justin Israel <justinisr...@gmail.com> wrote: > > > On Wednesday, May 1, 2019 at 7:06:47 AM UTC+12, Nitish Saboo wrote: >> >> Apologies.I did this 'strings.Split(C.GoString(*C.char),""). >> I am getting 'Incompatible types' compilation error. >> > > Are you literally doing this? > strings.Split(C.GoString(*C.char),"") > > Something like this should be working correctly: > > someCArr := getSomeCArr() > chars := strings.Split(C.GoString(someCArr),"") > > Is your goal to split the string into a slice of individual characters? > Because that is what your delim suggests. > > >> Thanks >> >> >> On Wed, May 1, 2019 at 12:30 AM Nitish Saboo <nitish...@gmail.com> wrote: >> >>> Hi, >>> >>> I want to convert *C.char to array of strings in Go. >>> I want to do this because I want the first word from the string.Strings >>> are getting appended to *C.char and I want the first word of the string. >>> I am doing it using 'strings.Split(C.GoString(*C.char))[0]', but it is >>> giving error. >>> Can someone correct me here ? >>> >>> Thanks >>> >>> -- >>> 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 golan...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- > 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. > For more options, visit https://groups.google.com/d/optout. > -- 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. For more options, visit https://groups.google.com/d/optout.