org.carewebframework.common.StrUtil类的使用及代码示例

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

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

StrUtil介绍

[英]Utility methods for managing strings.
[中]管理字符串的实用方法。

代码示例

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

/**
 * Splits a string using the specified delimiter.
 * 
 * @param text The string to split.
 * @param delimiter The delimiter for the split operation.
 * @return A string array containing the split values. The returned array is guaranteed not to
 *         contain null values by replacing every occurrence of a null value with an empty
 *         string.
 */
public static String[] split(String text, String delimiter) {
  return split(text, delimiter, 0);
}

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

/**
 * Returns the specified piece of text as delimited by delimiter.
 * 
 * @param text Text to piece.
 * @param delimiter Delimiter for piecing.
 * @param position Position of piece to extract.
 * @return The requested text piece.
 */
public static String piece(String text, String delimiter, int position) {
  return piece(text, delimiter, position, position);
}

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

/**
 * Builds a delimited string from a list.
 * 
 * @param list The list of strings to concatenate.
 * @param delimiter The delimiter to use to separate elements.
 * @return A string contains the list of elements separated by the specified delimiter.
 */
public static String fromList(Iterable<?> list, String delimiter) {
  return fromList(list, delimiter, "");
}

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

public Version(String value) {
  if (value != null && !value.isEmpty()) {
    String[] pcs = StrUtil.split(value, ".", 4);
    
    for (int i = 0; i < 4; i++) {
      seq[i] = StrUtil.extractInt(pcs[i]);
    }
  }
}

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

/**
 * Logic to return detail information for specified item.
 * 
 * @param data The item data.
 * @return The detail information.
 */
@Override
protected String getDetail(String data) {
  data = piece(data, U);
  return data.isEmpty() ? null : fromList(getBroker().callRPCList(detailRPC, null, patient.getId().getIdPart(), data,
    data));
}

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

/**
 * Logic to return detail information for specified item.
 * 
 * @param data The item data.
 * @return The detail information.
 */
@Override
protected String getDetail(String data) {
  String pcs[] = split(data, U, 2);
  char type = pcs[1].isEmpty() ? 0 : pcs[1].charAt(0);
  List<String> result = new ArrayList<String>();
  
  switch (type) {
    case 'A':
      getBroker().callRPCList("RGCWCACV DETAIL", result, patient.getId().getIdPart());
      break;
    
    case 'F':
      getBroker().callRPCList("RGCWCACV PRF", result, patient.getId().getIdPart(), pcs[0]);
      break;
    
    default:
      getBroker().callRPCList("TIU GET RECORD TEXT", result, pcs[0]);
      break;
  }
  
  return result.isEmpty() ? null : fromList(result);
}

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

/**
 * Formats a message. If the message begins with "@", the remainder is assumed to be a label
 * identifier that is resolved.
 * 
 * @param msg Message to format or, if starts with "@", a label reference.
 * @param args Optional replaceable parameters.
 * @return The formatted message.
 */
public static String formatMessage(String msg, Object... args) {
  return formatMessage(msg, null, args);
}

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

/**
 * Converts a string containing a delimited list of elements to a string list.
 * 
 * @param text The string containing the delimited elements.
 * @param delimiter The delimiter that separates the elements in the input string.
 * @return A list containing the parsed elements.
 */
public static List<String> toList(String text, String delimiter) {
  return toList(text, null, delimiter);
}

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

/**
 * Returns a formatted message given a label identifier.
 * 
 * @param id A label identifier.
 * @param args Optional replaceable parameters.
 * @return The formatted label.
 */
public static String getLabel(String id, Object... args) {
  return getLabel(id, null, args);
}

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

String original = "1,2,3,4,5";
List<String> strList = StrUtil.toList(original, ",");
assertEquals(5, strList.size());
String str = StrUtil.fromList(strList, ",");
assertEquals(original, str);
strList = StrUtil.toList(",,3,4,5,", ",");
assertEquals(5, strList.size());
str = StrUtil.fromList(intList, ",");
assertEquals(original, str);
str = StrUtil.fromList(intList, ",");
assertEquals("1,2,,4,5", str);
str = StrUtil.fromList(intList, ",", null);
assertEquals("1,2,4,5", str);
str = StrUtil.fromList(intList, ",", "3");
assertEquals(original, str);
List<Object> iterList = new ArrayList<>();

代码示例来源:origin: org.carewebframework/org.carewebframework.cal.api.core

public SearchException(String label, Throwable cause) {
  super(StrUtil.formatMessage(label), cause);
}

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

/**
 * Converts a string containing a '\n'-delimited list of elements to a string list.
 * 
 * @param text The string containing the '\n'-delimited elements.
 * @param list The string list that will receive the parsed elements. If null, a new list is
 *            created. If not null, the list is cleared before adding elements.
 * @return A list containing the parsed elements. If the input list was not null, that instance
 *         is returned. Otherwise, a newly created list is returned.
 */
public static List<String> toList(String text, List<String> list) {
  return toList(text, list, LINE_TERMINATOR);
}

代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core

/**
 * Invoked when inactivity timeout has occurred.
 */
public void onTimer$timer() {
  close(StrUtil.getLabel(Constants.LBL_LOGIN_FORM_TIMEOUT_MESSAGE));
}

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

/**
 * Splits a string using the specified delimiter.
 * 
 * @param text The string to split.
 * @param delimiter The delimiter for the split operation.
 * @param count Specifies a minimum number of elements to be returned. If the result of the
 *            split operation results in fewer elements, the returned array is expanded to
 *            contain the minimum number of elements.
 * @return A string array containing the split values. The returned array is guaranteed not to
 *         contain null values by replacing every occurrence of a null value with an empty
 *         string.
 */
public static String[] split(String text, String delimiter, int count) {
  return split(text, delimiter, count, true);
}

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

/**
 * Returns the first piece of text as delimited by delimiter.
 * 
 * @param text Text to piece.
 * @param delimiter Delimiter for piecing.
 * @return First piece of text.
 */
public static String piece(String text, String delimiter) {
  return piece(text, delimiter, 1);
}

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

/**
 * Builds a newline-delimited string from a list.
 * 
 * @param list The list of strings to concatenate.
 * @return A string contains the list of elements separated by the newline character.
 */
public static String fromList(Iterable<?> list) {
  return fromList(list, "\n");
}

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

public FrameworkCheckedException(String msg, Throwable cause, String throwableContext, Object... params) {
  super(StrUtil.formatMessage(msg, null, params), cause);
  this.throwableContext = throwableContext;
  
  if (msg.startsWith("@")) {
    errorCode = msg.substring(1);
  }
}

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

/**
 * Converts a string containing a '\n'-delimited list of elements to a string list.
 * 
 * @param text The string containing the '\n'-delimited elements.
 * @return A list containing the parsed elements.
 */
public static List<String> toList(String text) {
  return toList(text, null, LINE_TERMINATOR);
}

代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core

/**
 * Returns the minimum length for random password.
 * 
 * @return Minimum length for random password.
 */
protected int getRandomPasswordLength() {
  return NumberUtils.toInt(StrUtil.getLabel(Constants.LBL_PASSWORD_RANDOM_LENGTH), 12);
}

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

@Override
protected void render(String dao, List<Object> columns) {
  String pcs[] = split(dao, U, 2);
  
  if (!pcs[0].isEmpty()) {
    columns.add(pcs[1]);
  }
}

相关文章