Skip to content

Commit

Permalink
1. Added some generic use utils.
Browse files Browse the repository at this point in the history
2. Updated README.md
  • Loading branch information
amitjangid80 committed Jun 23, 2018
1 parent 9997b8d commit 9f1dd73
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,34 @@ Utils.getSha512Hash(stringToHash);
* @return string converted into hash value.
**/
Utils.getSha512Hash(byte[] dataToHash);

/**
* 2018 June 23 - Saturday - 10:30 AM
* right padding method
*
* this method will append empty or blank or spaces
* after the string for specified length.
*
* @param strText - String text to append spaces to the right
* @param length - length of the string text including spaces and text.
*
* @return - returns the string with spaces appended to the right of the string
**/
Utils.rightPadding(String strText, int length);

/**
* 2018 June 23 - Saturday - 10:30 AM
* left padding method
*
* this method will append empty or blank or spaces
* after the string for specified length.
*
* @param strText - String text to append spaces to the left
* @param length - length of the string text including spaces and text.
*
* @return - returns the string with spaces appended to the left of the string.
**/
Utils.leftPadding(String strText, int length);
```

### AnimUtil
Expand Down Expand Up @@ -855,4 +883,4 @@ AnimUtil.bounceAnim(Context context, View view);
```java
ShineButton shineButton = findViewById(R.id.shine_button);
shineButton.init(MainActivity.this);
```
```
34 changes: 34 additions & 0 deletions app/src/main/java/com/amit/utilities/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -572,4 +572,38 @@ public static Point getScreenSize(Context context)
wm.getDefaultDisplay().getSize(point);
return point;
}

/**
* 2018 June 23 - Saturday - 10:30 AM
* right padding method
*
* this method will append empty or blank or spaces
* after the string for specified length.
*
* @param strText - String text to append spaces to the right
* @param length - length of the string text including spaces and text.
*
* @return - returns the string with spaces appended to the right of the string
**/
public static String rightPadding(String strText, int length)
{
return String.format("%-" + length + "." + length + "s", strText);
}

/**
* 2018 June 23 - Saturday - 10:30 AM
* left padding method
*
* this method will append empty or blank or spaces
* after the string for specified length.
*
* @param strText - String text to append spaces to the left
* @param length - length of the string text including spaces and text.
*
* @return - returns the string with spaces appended to the left of the string.
**/
public static String leftPadding(String strText, int length)
{
return String.format("%" + length + "." + length + "s", strText);
}
}

0 comments on commit 9f1dd73

Please sign in to comment.