/** * <p> * Left pad a String with spaces. * </p> * <p> * The String is padded to the size of <code>n</code>. * </p> * * @param str String to pad out * @param size size to pad to * @return left padded String * @throws NullPointerException if str or delim is <code>null</code> */ public static String leftPad( String str, int size ) { return leftPad( str, size, " " ); }
/** * <p> * Center a String in a larger String of size <code>n</code>. * </p> * <p> * Uses a supplied String as the value to buffer the String with. * </p> * * @param str String to center * @param size int size of new String * @param delim String to buffer the new String with * @return String containing centered String * @throws NullPointerException if str or delim is <code>null</code> * @throws ArithmeticException if delim is the empty String */ public static String center( String str, int size, String delim ) { int sz = str.length(); int p = size - sz; if ( p < 1 ) { return str; } str = leftPad( str, sz + p / 2, delim ); str = rightPad( str, size, delim ); return str; }
public String f( Integer size, String s ) { return StringUtils.leftPad( s, size ); } };
public String f( Integer size, String s ) { return StringUtils.leftPad( s, size ); } };
/** * <p>Left pad a String with spaces.</p> * * <p>The String is padded to the size of <code>n</code>.</p> * * @param str String to pad out * @param size size to pad to * @return left padded String * @throws NullPointerException if str or delim is <code>null</code> */ public static String leftPad( String str, int size ) { return leftPad( str, size, " " ); }
/** * Takes a string and increments it as an integer. * Preserves any lpad of "0" zeros. * * @param s */ protected String incrementVersionString( String s ) { int n = Integer.valueOf( s ).intValue() + 1; String value = String.valueOf( n ); if ( value.length() < s.length() ) { // String was left-padded with zeros value = StringUtils.leftPad( value, s.length(), "0" ); } return value; }
/** * Takes a string and increments it as an integer. * Preserves any lpad of "0" zeros. * * @param s */ protected String incrementVersionString( String s ) { int n = Integer.valueOf( s ).intValue() + 1; String value = String.valueOf( n ); if ( value.length() < s.length() ) { // String was left-padded with zeros value = StringUtils.leftPad( value, s.length(), "0" ); } return value; }
/** * <p>Center a String in a larger String of size <code>n</code>.</p> * * <p>Uses a supplied String as the value to buffer the String with.</p> * * @param str String to center * @param size int size of new String * @param delim String to buffer the new String with * @return String containing centered String * @throws NullPointerException if str or delim is <code>null</code> * @throws ArithmeticException if delim is the empty String */ public static String center( String str, int size, String delim ) { int sz = str.length(); int p = size - sz; if ( p < 1 ) { return str; } str = leftPad( str, sz + p / 2, delim ); str = rightPad( str, size, delim ); return str; }
public JazzScmCommand createChangesetAssociateCommand( ScmProviderRepository repo, Integer changeSetAlias ) { JazzScmCommand command = new JazzScmCommand( JazzConstants.CMD_CHANGESET, JazzConstants.CMD_SUB_ASSOCIATE, repo, false, null, getLogger() ); // Add the change set alias JazzScmProviderRepository jazzRepo = (JazzScmProviderRepository) repo; // SCM-812 - Jazz SCM Alias Id's roll over to zero, not 1000 as advertised. // So, we need to add the changeSetAlias with leading zeros. command.addArgument( StringUtils.leftPad( changeSetAlias.toString(), 4, "0" ) ); // Add the work item number command.addArgument( jazzRepo.getWorkItem() ); return command; }
public JazzScmCommand createChangesetAssociateCommand( ScmProviderRepository repo, Integer changeSetAlias ) { JazzScmCommand command = new JazzScmCommand( JazzConstants.CMD_CHANGESET, JazzConstants.CMD_SUB_ASSOCIATE, repo, false, null, getLogger() ); // Add the change set alias JazzScmProviderRepository jazzRepo = (JazzScmProviderRepository) repo; // SCM-812 - Jazz SCM Alias Id's roll over to zero, not 1000 as advertised. // So, we need to add the changeSetAlias with leading zeros. command.addArgument( StringUtils.leftPad( changeSetAlias.toString(), 4, "0" ) ); // Add the work item number command.addArgument( jazzRepo.getWorkItem() ); return command; }
.append(StringUtils.center(var.getDescription(), MESSAGE_LINE_LENGTH)) .append(NEW_LINE) .append(StringUtils.leftPad("[default: " + val + "]", MESSAGE_LINE_LENGTH)) .append(NEW_LINE) .append(StringUtils.repeat("*", MESSAGE_LINE_LENGTH));
if (right.length() + left.length() + 3 > INFO_PAD_SIZE) { t.add(left + "..."); t.add(StringUtils.leftPad(right, INFO_PAD_SIZE));
t.add( StringUtils.leftPad( right, INFO_PAD_SIZE ) );
t.add( StringUtils.leftPad( right, INFO_PAD_SIZE ) );
StringUtils.leftPad( file.getStatus().toString(), maxLen ) + " status for " + getRelativePath( baseDir, file.getPath() ) );