Skip to content

Commit 9f1dd73

Browse files
committed
1. Added some generic use utils.
2. Updated README.md
1 parent 9997b8d commit 9f1dd73

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

.idea/caches/build_file_checksums.ser

-5 Bytes
Binary file not shown.

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,34 @@ Utils.getSha512Hash(stringToHash);
702702
* @return string converted into hash value.
703703
**/
704704
Utils.getSha512Hash(byte[] dataToHash);
705+
706+
/**
707+
* 2018 June 23 - Saturday - 10:30 AM
708+
* right padding method
709+
*
710+
* this method will append empty or blank or spaces
711+
* after the string for specified length.
712+
*
713+
* @param strText - String text to append spaces to the right
714+
* @param length - length of the string text including spaces and text.
715+
*
716+
* @return - returns the string with spaces appended to the right of the string
717+
**/
718+
Utils.rightPadding(String strText, int length);
719+
720+
/**
721+
* 2018 June 23 - Saturday - 10:30 AM
722+
* left padding method
723+
*
724+
* this method will append empty or blank or spaces
725+
* after the string for specified length.
726+
*
727+
* @param strText - String text to append spaces to the left
728+
* @param length - length of the string text including spaces and text.
729+
*
730+
* @return - returns the string with spaces appended to the left of the string.
731+
**/
732+
Utils.leftPadding(String strText, int length);
705733
```
706734

707735
### AnimUtil
@@ -855,4 +883,4 @@ AnimUtil.bounceAnim(Context context, View view);
855883
```java
856884
ShineButton shineButton = findViewById(R.id.shine_button);
857885
shineButton.init(MainActivity.this);
858-
```
886+
```

app/src/main/java/com/amit/utilities/Utils.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,4 +572,38 @@ public static Point getScreenSize(Context context)
572572
wm.getDefaultDisplay().getSize(point);
573573
return point;
574574
}
575+
576+
/**
577+
* 2018 June 23 - Saturday - 10:30 AM
578+
* right padding method
579+
*
580+
* this method will append empty or blank or spaces
581+
* after the string for specified length.
582+
*
583+
* @param strText - String text to append spaces to the right
584+
* @param length - length of the string text including spaces and text.
585+
*
586+
* @return - returns the string with spaces appended to the right of the string
587+
**/
588+
public static String rightPadding(String strText, int length)
589+
{
590+
return String.format("%-" + length + "." + length + "s", strText);
591+
}
592+
593+
/**
594+
* 2018 June 23 - Saturday - 10:30 AM
595+
* left padding method
596+
*
597+
* this method will append empty or blank or spaces
598+
* after the string for specified length.
599+
*
600+
* @param strText - String text to append spaces to the left
601+
* @param length - length of the string text including spaces and text.
602+
*
603+
* @return - returns the string with spaces appended to the left of the string.
604+
**/
605+
public static String leftPadding(String strText, int length)
606+
{
607+
return String.format("%" + length + "." + length + "s", strText);
608+
}
575609
}

0 commit comments

Comments
 (0)