org.pentaho.di.core.Const.isSpace()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(179)

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

Const.isSpace介绍

[英]Determines whether or not a character is considered a space. A character is considered a space in Kettle if it is a space, a tab, a newline or a cariage return.
[中]确定字符是否被视为空格。如果一个字符是空格、制表符、换行符或换行符,则该字符被视为壶中的空格。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Determines whether or not a character is considered a space. A character is considered a space in Kettle if it is a
 * space, a tab, a newline or a cariage return.
 *
 * @param c
 *          The character to verify if it is a space.
 * @return true if the character is a space. false otherwise.
 * @deprecated Use {@link Const#isSpace(char)} instead
 */
@Deprecated
public static final boolean isSpace( char c ) {
 return Const.isSpace( c );
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Checks whether or not a String consists only of spaces.
 *
 * @param str
 *          The string to check
 * @return true if the string has nothing but spaces.
 */
public static boolean onlySpaces( String str ) {
 for ( int i = 0; i < str.length(); i++ ) {
  if ( !isSpace( str.charAt( i ) ) ) {
   return false;
  }
 }
 return true;
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Left trim: remove spaces to the left of a String.
 *
 * @param source
 *          The String to left trim
 * @return The left trimmed String
 */
public static String ltrim( String source ) {
 if ( source == null ) {
  return null;
 }
 int from = 0;
 while ( from < source.length() && isSpace( source.charAt( from ) ) ) {
  from++;
 }
 return source.substring( from );
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Right trim: remove spaces to the right of a string
 *
 * @param source
 *          The string to right trim
 * @return The trimmed string.
 */
public static String rtrim( String source ) {
 if ( source == null ) {
  return null;
 }
 int max = source.length();
 while ( max > 0 && isSpace( source.charAt( max - 1 ) ) ) {
  max--;
 }
 return source.substring( 0, max );
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Trims a string: removes the leading and trailing spaces of a String.
 *
 * @param str
 *          The string to trim
 * @return The trimmed string.
 */
public static String trim( String str ) {
 if ( str == null ) {
  return null;
 }
 int max = str.length() - 1;
 int min = 0;
 while ( min <= max && isSpace( str.charAt( min ) ) ) {
  min++;
 }
 while ( max >= 0 && isSpace( str.charAt( max ) ) ) {
  max--;
 }
 if ( max < min ) {
  return "";
 }
 return str.substring( min, max + 1 );
}

代码示例来源:origin: pentaho/big-data-plugin

private int removeTrailingSpaces( StringBuilder buffer, int pos ) {
 while ( pos >= 0 && Const.isSpace( data.buffer.charAt( pos ) ) ) {
  pos--;
 }
 return pos;
}

相关文章