Sunday, 7 April 2013

String pad in java


public class Trial {
    public static void main(String arg[])
    {
        String password="password";
        String padded=String.format("%"+password.length()+"s","").replace(" ", "*");
        System.out.println(padded);
    }
}

Output:


run:
********
BUILD SUCCESSFUL (total time: 0 seconds)


Different types:


     String.format("%10s", "foo").replace(' ', '*');
     String.format("%-10s", "bar").replace(' ', '*');
     String.format("%10s", "longer than 10 chars").replace(' ', '*');

     Output:

        *******foo
        bar*******
        longer*than*10*chars



DBT - Models

Models are where your developers spend most of their time within a dbt environment. Models are primarily written as a select statement and ...