How to convert String object to Boolean Object?

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

How to convert String object to Boolean object?

14条回答
  •  再見小時候
    2020-11-28 02:05

    We created soyuz-to library to simplify this problem (convert X to Y). It's just a set of SO answers for similar questions. This might be strange to use the library for such a simple problem, but it really helps in a lot of similar cases.

    import io.thedocs.soyuz.to;
    
    Boolean aBoolean = to.Boolean("true");
    

    Please check it - it's very simple and has a lot of other useful features

提交回复
热议问题