File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,22 @@ def remove(self, chars: str) -> str:
187187
188188class Format :
189189 """Format texts"""
190+
191+ @staticmethod
192+ def surround (values : str , char : str = "*" ) -> str :
193+ """Surround a text with chars
194+
195+ Parameters
196+ ----------
197+ :param values:`str`
198+ Text to surround
199+ :param char:`*`
200+ Char to surround with
201+ :return:
202+ Returns a string with the text surrounded with chars
203+ """
204+ return f"{ char * (len (values ) + 4 )} \n { char } { values } { char } \n { char * (len (values ) + 4 )} "
205+
190206 @staticmethod
191207 def align (values : dict [str , str ]):
192208 """Algin a text
@@ -210,6 +226,8 @@ def align(values: dict[str, str]):
210226 aligned_text += key + " " * ((length + 3 ) - len (key )) + values [key ] + "\n "
211227 return aligned_text
212228
229+
230+
213231 @staticmethod
214232 def table (values : list [list [str ]], border : bool = True ) -> str :
215233 """Create a table
@@ -246,3 +264,5 @@ def table(values: list[list[str]], border: bool = True) -> str:
246264 if index != len (values ) - 1 :
247265 table += "\n "
248266 return table
267+
268+
You can’t perform that action at this time.
0 commit comments