get String from SpannableStringBuilder - Android android.text

Android examples for android.text:SpannableString

Description

get String from SpannableStringBuilder

Demo Code

import android.text.SpannableStringBuilder;
import java.security.MessageDigest;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{

    public static String getString(SpannableStringBuilder builder,
            int start, int end) {
        char[] chars = new char[end - start];
        builder.getChars(start, end, chars, 0);

        return new String(chars);
    }//  w ww  .j a v a 2s.  c om
    public static String getString(StringBuilder builder, int start, int end) {
        char[] chars = new char[end - start];
        builder.getChars(start, end, chars, 0);

        return new String(chars);
    }

}

Related Tutorials