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

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

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

Const.replace介绍

[英]Replace values in a String with another. 33% Faster using replaceAll this way than original method
[中]用另一个字符串替换字符串中的值。通过这种方式使用replace比原来的方法快33%

代码示例

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

@Override
public String massageFieldName( final String fieldName ) {
 // Replace all spaces and hyphens (-) with underscores (_)
 String massagedFieldName = fieldName;
 massagedFieldName = Const.replace( massagedFieldName, " ", "_" );
 massagedFieldName = Const.replace( massagedFieldName, "-", "_" );
 return massagedFieldName;
}

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

private String fixFileName( String filename ) {
 filename = filename.replace( '/', '_' ); // do something with illegal file name chars
 if ( !( "/".equals( Const.FILE_SEPARATOR ) ) ) {
  filename = Const.replace( filename, Const.FILE_SEPARATOR, "_" );
 }
 return filename;
}

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

private String calcDirectoryName( RepositoryDirectoryInterface dir ) {
 StringBuilder directory = new StringBuilder();
 String baseDir = repositoryMeta.getBaseDirectory();
 baseDir = Const.replace( baseDir, "\\", "/" );
 directory.append( baseDir );
 if ( !baseDir.endsWith( "/" ) ) {
  directory.append( "/" );
 }
 if ( dir != null ) {
  String path = calcRelativeElementDirectory( dir );
  if ( path.startsWith( "/" ) ) {
   directory.append( path.substring( 1 ) );
  } else {
   directory.append( path );
  }
  if ( !path.endsWith( "/" ) ) {
   directory.append( "/" );
  }
 }
 return directory.toString();
}

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

public static String getFilename( FileObject fileObject ) {
 FileName fileName = fileObject.getName();
 String root = fileName.getRootURI();
 if ( !root.startsWith( "file:" ) ) {
  return fileName.getURI();
 }
 if ( root.endsWith( ":/" ) ) {
  root = root.substring( 8, 10 );
 } else {
  root = root.substring( 7, root.length() - 1 );
 }
 String fileString = root + fileName.getPath();
 if ( !"/".equals( Const.FILE_SEPARATOR ) ) {
  fileString = Const.replace( fileString, "/", Const.FILE_SEPARATOR );
 }
 return fileString;
}

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

public static String constructUrl( VariableSpace space, String hostname, String port, String webAppName,
                  String serviceAndArguments, boolean isSecure )
 throws UnsupportedEncodingException {
 String realHostname = space.environmentSubstitute( hostname );
 if ( !StringUtils.isEmpty( webAppName ) ) {
  serviceAndArguments = "/" + space.environmentSubstitute( webAppName ) + serviceAndArguments;
 }
 String protocol = isSecure ? PROTOCOL_SECURE : PROTOCOL_UNSECURE;
 String retval = protocol + "://" + realHostname + getPortSpecification( space, port ) + serviceAndArguments;
 retval = Const.replace( retval, " ", "%20" );
 return retval;
}

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

public static String getFilename( FileObject fileObject ) {
 FileName fileName = fileObject.getName();
 String root = fileName.getRootURI();
 if ( !root.startsWith( "file:" ) ) {
  return fileName.getURI(); // nothing we can do about non-normal files.
 }
 if ( root.startsWith( "file:////" ) ) {
  return fileName.getURI(); // we'll see 4 forward slashes for a windows/smb network share
 }
 if ( root.endsWith( ":/" ) ) { // Windows
  root = root.substring( 8, 10 );
 } else { // *nix & OSX
  root = "";
 }
 String fileString = root + fileName.getPath();
 if ( !"/".equals( Const.FILE_SEPARATOR ) ) {
  fileString = Const.replace( fileString, "/", Const.FILE_SEPARATOR );
 }
 return fileString;
}

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

public String constructUrl( String serviceAndArguments ) throws UnsupportedEncodingException {
 String realHostname = null;
 String proxyHostname = null;
 lock.readLock().lock();
 try {
  realHostname = environmentSubstitute( hostname );
  proxyHostname = environmentSubstitute( getProxyHostname() );
 } finally {
  lock.readLock().unlock();
 }
 if ( !Utils.isEmpty( proxyHostname ) && realHostname.equals( "localhost" ) ) {
  realHostname = "127.0.0.1";
 }
 if ( !StringUtils.isBlank( webAppName ) ) {
  serviceAndArguments = "/" + environmentSubstitute( getWebAppName() ) + serviceAndArguments;
 }
 String result =
  ( isSslMode() ? HTTPS : HTTP ) + "://" + realHostname + getPortSpecification() + serviceAndArguments;
 result = Const.replace( result, " ", "%20" );
 return result;
}

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

filename = Const.replace( transMeta.getFilename(), " ", "_" ).toLowerCase() + ".kar";

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

public Value replace( String repl, String with ) {
 if ( isNull() ) {
  return this;
 }
 if ( getString() == null ) {
  setNull();
 } else {
  setValue( Const.replace( getString(), repl, with ) );
 }
 return this;
}

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

pol = Const.replace( pol, replace, enclosure );
pol = Const.replace( pol, replace, delimiter );

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

String replaceWith = enclosure;
pol = Const.replace( pol, replace, replaceWith );
String replaceWith = delimiter;
pol = Const.replace( pol, replace, replaceWith );
String replaceWith = escapeCharacter;
pol = Const.replace( pol, replace, replaceWith );

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

String replaceWith = enclosure;
pol = Const.replace( pol, replace, replaceWith );
String replaceWith = delimiter;
pol = Const.replace( pol, replace, replaceWith );
String replaceWith = inf.content.escapeCharacter;
pol = Const.replace( pol, replace, replaceWith );

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

String replaceWith = enclosure;
pol = Const.replace( pol, replace, replaceWith );
String replaceWith = delimiter;
pol = Const.replace( pol, replace, replaceWith );

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

String replaceWith = enclosure;
pol = Const.replace( pol, replace, replaceWith );
String replaceWith = delimiter;
pol = Const.replace( pol, replace, replaceWith );

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

if ( string != null ) {
 if ( meta.getFieldFormatType()[i] == MySQLBulkLoaderMeta.FIELD_FORMAT_TYPE_STRING_ESCAPE ) {
  string = Const.replace( string, meta.getEscapeChar(), meta.getEscapeChar() + meta.getEscapeChar() );
  string = Const.replace( string, meta.getEnclosure(), meta.getEscapeChar() + meta.getEnclosure() );

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

buttons[ i ].setToolTipText( Const.replace( buttons[ i ].getText(), "&", "" ) );

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

private void getInfo() {
  stepErrorMeta.setTargetStep( StepMeta.findStep( targetSteps, wTargetStep.getText() ) );
  stepErrorMeta.setEnabled( wEnabled.getSelection() );
  stepErrorMeta.setNrErrorsValuename( wNrErrors.getText() );
  stepErrorMeta.setErrorDescriptionsValuename( wErrDesc.getText() );
  stepErrorMeta.setErrorFieldsValuename( wErrFields.getText() );
  stepErrorMeta.setErrorCodesValuename( wErrCodes.getText() );
  stepErrorMeta.setMaxErrors( wMaxErrors.getText() );
  stepErrorMeta.setMaxPercentErrors( Const.replace( wMaxPct.getText(), "%", "" ) );
  stepErrorMeta.setMinPercentRows( wMinPctRows.getText() );
 }
}

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

FieldSeparator = "FIELDS TERMINATED BY '" + Const.replace( getRealSeparator(), "'", "''" ) + "'";
 "LINES TERMINATED BY '" + Const.replace( getRealLineterminated(), "'", "''" ) + "'";
 OptionEnclosed + "ENCLOSED BY '" + Const.replace( getRealEnclosed(), "'", "''" ) + "'";

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

FieldTerminatedby =
 FieldTerminatedby
  + "TERMINATED BY '" + Const.replace( getRealSeparator(), "'", "''" ) + "'";
 FieldTerminatedby + " ENCLOSED BY '" + Const.replace( getRealEnclosed(), "'", "''" ) + "'";
 FieldTerminatedby + " ESCAPED BY '" + Const.replace( getRealEscaped(), "'", "''" ) + "'";
LineTerminatedby =
 LineTerminatedby
  + "STARTING BY '" + Const.replace( getRealLinestarted(), "'", "''" ) + "'";
LineTerminatedby =
 LineTerminatedby
  + " TERMINATED BY '" + Const.replace( getRealLineterminated(), "'", "''" ) + "'";

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

field = Const.replace( field, " ", "_" );
field = Const.replace( field, "-", "_" );

相关文章