Code example for SuperscriptSpan

0
        return getSuperscriptString(base, 0, base.length() - 1);
    } 
 
    public static CharSequence getSuperscriptString(CharSequence base, int startFromIdx, int endAtIdx) {
        SpannableString str = new SpannableString(base);
        str.setSpan(new SuperscriptSpan(), startFromIdx, endAtIdx, Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
        return str;
    } 
 
    public static CharSequence getSubscriptString(CharSequence base) {
        return getSubscriptString(base, 0, base.length() - 1);
    } 
 
    public static CharSequence getSubscriptString(CharSequence base, int startFromIdx, int endAtIdx) {
        SpannableString str = new SpannableString(base);
        str.setSpan(new SubscriptSpan(), startFromIdx, endAtIdx, Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
        return str;
    } 
 
    /**