// String returns the string formated representation of the cell func (c *Cell) String() string { if c.Data == nil { return strutil.PadLeft(" ", int(c.Width), ' ') } s := fmt.Sprintf("%v", c.Data) switch { case c.Width > 0 && c.Wrap: return wordwrap.WrapString(s, c.Width) case c.Width > 0: return strutil.Resize(s, c.Width) } return s }
// String returns the string formated representation of the cell func (c *Cell) String() string { if c.Data == nil { return strutil.PadLeft(" ", int(c.Width), ' ') } s := fmt.Sprintf("%v", c.Data) if c.Width > 0 { if c.Wrap && uint(len(s)) > c.Width { return wordwrap.WrapString(s, c.Width) } else { return strutil.Resize(s, c.Width, c.RightAlign) } } return s }