code: @Nullable
      public MentionSpan getMentionSpanEndingAt(int index) {
          MentionSpan[] spans = getSpans(0, length(), MentionSpan.class);
          if (spans != null) {
              for (MentionSpan span : spans) {
                  if (getSpanEnd(span) == index) {
                      return span;
                  }
              }
          }
          return null;
      }
docs: Get the {@link MentionSpan} ending at the given index in the text, or null if there is no {@link MentionSpan}
  ending at that index.
  
  @param index integer offset in text
  
  @return a {@link MentionSpan} ending at index in text, or null