org.carewebframework.common.StrUtil.toBoolean()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(81)

本文整理了Java中org.carewebframework.common.StrUtil.toBoolean()方法的一些代码示例,展示了StrUtil.toBoolean()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StrUtil.toBoolean()方法的具体详情如下:
包路径:org.carewebframework.common.StrUtil
类名称:StrUtil
方法名:toBoolean

StrUtil.toBoolean介绍

[英]Converts a text value to a boolean result.
[中]将文本值转换为布尔结果。

代码示例

代码示例来源:origin: org.carewebframework/org.carewebframework.common

/**
 * Sets the default flag.
 * 
 * @param value Boolean string expression.
 */
private void setDefault(String value) {
  this.dflt = StrUtil.toBoolean(value);
}

代码示例来源:origin: org.carewebframework/org.carewebframework.vista.ui.settings

@Override
public Boolean fromSource(String value) {
  return value == null ? null : StrUtil.toBoolean(value);
}

代码示例来源:origin: org.carewebframework/org.carewebframework.common

@Test
public void testBooleanUtil() {
  assertTrue(StrUtil.toBoolean("YES"));
  assertTrue(StrUtil.toBoolean("Y"));
  assertTrue(StrUtil.toBoolean("yes"));
  assertTrue(StrUtil.toBoolean("y"));
  assertTrue(StrUtil.toBoolean("TRUE"));
  assertTrue(StrUtil.toBoolean("t"));
  assertTrue(StrUtil.toBoolean("1"));
  assertTrue(StrUtil.toBoolean("100"));
  assertFalse(StrUtil.toBoolean(null));
  assertFalse(StrUtil.toBoolean(""));
  assertFalse(StrUtil.toBoolean("false"));
  assertFalse(StrUtil.toBoolean("0"));
  assertFalse(StrUtil.toBoolean("any old string"));
}

代码示例来源:origin: org.carewebframework/org.carewebframework.vista.api.notification

/**
 * Create a notification from server data.
 * 
 * @param data Format is <code>
 *    1        2           3               4             5            6              7      8       9        10         11         12
 * Priority^Info Only^Patient Name^ Patient Location ^Subject^Date Delivered^Sender Name^DFN^Alert Type^Alert ID^Can Delete^Extra Info
 * </code>
 */
public Notification(String data) {
  String[] pcs = StrUtil.split(data, U, 12);
  setPriority(Priority.fromString(pcs[0]));
  setActionable(!StrUtil.toBoolean(pcs[1]));
  setPatientName(pcs[2]);
  setPatientLocation(pcs[3]);
  setSubject(pcs[4]);
  setDeliveryDate(FMDate.fromString(pcs[5]));
  setSenderName(pcs[6]);
  setDfn(pcs[7]);
  setType(pcs[8]);
  setAlertId(pcs[9]);
  setCanDelete(StrUtil.toBoolean(pcs[10]));
  setExtraInfo(Arrays.copyOfRange(pcs, 11, pcs.length));
}

相关文章