FAQ
Suppose we had

s := "foo"

so that len(s) == 3. How many possible prefixes are there of the "foo"
string? The answer is 4: "", "f", "fo" and "foo". They correspond to
s[:0], s[:1], s[:2], s[:3].

How many possible suffixes are there of the "foo" string? The answer
is again 4: "", "o", "oo" and "foo". They correspond to s[3:], s[2:],
s[1:], s[0:].

Note that s[3:] is a valid (empty) string, even though len(s) == 3 and
s[3] will panic with out-of-range.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 6 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedApr 6, '16 at 12:30a
activeApr 11, '16 at 5:32a
posts6
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase