add Suffix to string - Android java.lang

Android examples for java.lang:String Starts or Ends

Description

add Suffix to string

Demo Code

import android.annotation.SuppressLint;
import java.io.UnsupportedEncodingException;
import java.util.regex.Pattern;

public class Main{

        public static String addSuffix(String src, String suffix) {
            if (src == null || suffix == null) {
                return src;
            }/*from ww  w. jav a 2s .co m*/
            StringBuilder sb = new StringBuilder();
            sb.append(src);
            sb.append(suffix);
            return sb.toString();
        }

}

Related Tutorials