Sorry, but why is that?

On Tuesday, June 26, 2012 at 6:27:14 AM UTC-7, Peter S wrote:
>
> It follows this simple rule: the length of the result slice is the number 
> of occurrences of the separator plus one. It is the "right" (intended) 
> behavior, not a bug; in fact godoc has an equivalent example: 
> http://golang.org/pkg/strings/#Split
>
> Peter
>
> On Tue, Jun 26, 2012 at 10:07 PM, Googol Lee <[email protected] 
> <javascript:>> wrote:
>
>> func main() {
>>   empty_string := ""
>>   result := strings.Split(empty_string, " ")
>>   fmt.Println(len(result)) // here length is 1
>> }
>>
>> If split a empty string, and get a array with one empty string, is that 
>> right behavior? I think it should return a empty array.
>>
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/19bfe1af-bf5f-4c54-9198-3d23f9bec14a%40googlegroups.com.

Reply via email to