How to convert String object to Boolean Object?

前端 未结 14 804
我寻月下人不归
我寻月下人不归 2020-11-28 01:28

How to convert String object to Boolean object?

14条回答
  •  感情败类
    2020-11-28 02:15

    Why not use a regular expression ?

    public static boolean toBoolean( String target )
    {
        if( target == null ) return false;
        return target.matches( "(?i:^(1|true|yes|oui|vrai|y)$)" );
    }
    

提交回复
热议问题