Java Boolean to String booleanToString(boolean a_boolean, String aS_True, String aS_False)

Here you can find the source of booleanToString(boolean a_boolean, String aS_True, String aS_False)

Description

Converts boolean to String
Also null are handled correctly.

License

Open Source License

Parameter

Parameter Description
a_boolean boolean which will be converted
aS_True String which represents true value
aS_False String which represents false value

Return

String corresponding value depeding of a_boolean

Declaration

public static String booleanToString(boolean a_boolean, String aS_True, String aS_False) 

Method Source Code

//package com.java2s;
/*//  w  w  w . ja  v  a2 s. c o m
NetForm Library
---------------
Copyright (C) 2001-2005 - Sampsa Sohlman, Teemu Sohlman
    
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
    
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.
    
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
*/

public class Main {
    /**
     * Converts boolean to String<br>
     * <i>Also null are handled correctly. All String parameters can have nulls.</i>
     * @param a_boolean boolean which will be converted
     * @param aS_True String which represents true value
     * @param aS_False String which represents false value
     * @return String corresponding value depeding of a_boolean
     */
    public static String booleanToString(boolean a_boolean, String aS_True, String aS_False) {
        if (a_boolean) {
            return aS_True;
        } else {
            return aS_False;
        }
    }
}

Related

  1. boolean2XML(Boolean b)
  2. boolean2XML(Boolean b)
  3. booleanToCheckBox(final boolean value)
  4. BooleanToString(boolean aB)
  5. booleanToString(boolean b)
  6. booleanToString(Boolean b)
  7. booleanToString(boolean value)