(self, in_str, justify_right)
return self
Justify a str into an existing buffer and pad with spaces.
Justify a str into an existing buffer and pad with spaces.
Justify a str into an existing buffer and pad with spaces .
def lset(self, in_str, justify_right):
        """Justify a str into an existing buffer and pad with spaces."""
        # v is empty string if variable does not exist
        # trim and pad to size of target buffer
        length = self.length()
        in_str = in_str.to_value()
        if justify_right:
            in_str = in_str[:length].rjust(length)
        else:
            in_str = in_str[:length].ljust(length)
        # make a copy only if not in a writeable location
        target = self._stringspace.check_modify(*self.to_pointer())
        self.from_pointer(*target)
        # copy the new string in
        self._stringspace.view(*target)[:] = in_str
        return self
def lset ( self , in_str , justify_right ) : # v is empty string if variable does not exist # trim and pad to size of target buffer length = self . length ( ) in_str = in_str . to_value ( ) if justify_right : in_str = in_str [ : length ] . rjust ( length ) else : in_str = in_str [ : length ] . ljust ( length ) # make a copy only if not in a writeable location target = self . _stringspace . check_modify ( * self . to_pointer ( ) ) self . from_pointer ( * target ) # copy the new string in self . _stringspace . view ( * target ) [ : ] = in_str return self