Using the Standard library's suffix array [SOLVED]

Hey everyone,

I’m trying to use the index/suffixarray package, but I’m having issues. I’m not sure it does what I want it to do. I’d like a sorted array of all the suffixes of a given string. I don’t think It does that. If it does and I am just missing it could you teach me.

Not sure but I think this is what you want to do:
https://play.golang.org/p/J68yaXXLnG

Basic example of how to use that package, more details in the docs: http://godoc.org/index/suffixarray

more of what I want is like for your array to call suffix array with lets say banana
it would return me an array like

[
"a",
"ana",
"anana",
"banana",
"na",
"nana"
]

I don’t know that suffix is the way to go for that since, you are essentially just stripping each index out of the given string:
https://play.golang.org/p/_aXfY5nDmb

Is that more what you’re wanting to do?

Yeah I guess so … but then I need to sort it myself. OK thank you Curt you’re always very helpful

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.