org.apache.directory.api.util.Strings.deepTrim()方法的使用及代码示例

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

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

Strings.deepTrim介绍

[英]A deep trim of a string remove whitespace from the ends as well as excessive whitespace within the inside of the string between non-whitespace characters. A deep trim reduces internal whitespace down to a single space to preserve the whitespace separated tokenization order of the String.
[中]对字符串进行深度修剪可以去除字符串末端的空白以及非空白字符之间字符串内部的多余空白。深度修剪将内部空格减少到单个空格,以保留字符串的以空格分隔的标记化顺序。

代码示例

代码示例来源:origin: org.apache.directory.api/api-all

/**
 * This does the same thing as a trim but we also lowercase the string while
 * performing the deep trim within the same buffer. This saves us from
 * having to create multiple String and StringBuilder objects and is much
 * more efficient.
 *
 * @see Strings#deepTrim( String )
 * @param string The String to modify
 * @return The modified String
 */
public static String deepTrimToLower( String string )
{
  return deepTrim( string, true );
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * A deep trim of a string remove whitespace from the ends as well as
 * excessive whitespace within the inside of the string between
 * non-whitespace characters. A deep trim reduces internal whitespace down
 * to a single space to preserve the whitespace separated tokenization order
 * of the String.
 *
 * @param string the string to deep trim.
 * @return the trimmed string.
 */
public static String deepTrim( String string )
{
  return deepTrim( string, false );
}

代码示例来源:origin: org.apache.directory.api/api-all

/**
 * A deep trim of a string remove whitespace from the ends as well as
 * excessive whitespace within the inside of the string between
 * non-whitespace characters. A deep trim reduces internal whitespace down
 * to a single space to preserve the whitespace separated tokenization order
 * of the String.
 *
 * @param string the string to deep trim.
 * @return the trimmed string.
 */
public static String deepTrim( String string )
{
  return deepTrim( string, false );
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * This does the same thing as a trim but we also lowercase the string while
 * performing the deep trim within the same buffer. This saves us from
 * having to create multiple String and StringBuilder objects and is much
 * more efficient.
 *
 * @see Strings#deepTrim( String )
 * @param string The String to modify
 * @return The modified String
 */
public static String deepTrimToLower( String string )
{
  return deepTrim( string, true );
}

相关文章