File tree Expand file tree Collapse file tree 3 files changed +63
-1
lines changed
app/src/main/java/com/amit/utilities Expand file tree Collapse file tree 3 files changed +63
-1
lines changed Original file line number Diff line number Diff line change @@ -702,6 +702,34 @@ Utils.getSha512Hash(stringToHash);
702702 * @return string converted into hash value.
703703**/
704704Utils . 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
856884ShineButton shineButton = findViewById(R . id. shine_button);
857885shineButton. init(MainActivity . this );
858- ```
886+ ```
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments