Android String Decode decode(String sourceStr, String compareStr, String returnStr, String defaultStr)

Here you can find the source of decode(String sourceStr, String compareStr, String returnStr, String defaultStr)

Description

decode

Declaration

public static String decode(String sourceStr, String compareStr,
        String returnStr, String defaultStr) 

Method Source Code

//package com.java2s;

public class Main {

    public static String decode(String sourceStr, String compareStr,
            String returnStr, String defaultStr) {
        if (sourceStr == null && compareStr == null) {
            return returnStr;
        }//from   w  w  w.j  ava  2  s. c  o  m

        if (sourceStr == null && compareStr != null) {
            return defaultStr;
        }

        if (sourceStr.trim().equals(compareStr)) {
            return returnStr;
        }

        return defaultStr;
    }

    public static String decode(String sourceStr, String compareStr,
            String returnStr) {
        return decode(sourceStr, compareStr, returnStr, sourceStr);
    }
}

Related

  1. decode(@Nonnull final String input)
  2. decode(String s)
  3. decode(String str, int flags)
  4. decodeWebSafe(String s)
  5. decode(String sourceStr, String compareStr, String returnStr)
  6. decode(String str)
  7. decode(String str)
  8. decode(String base64)
  9. decode(String source)