Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2023.1.0 - Português


justify

Alinha o texto em cada coluna completada com espaços, à esquerda, ao centro ou à direita

Seqüência de Chamamento

TJ = justify(T, position)

Parâmetros

T, TJ

vectores, matrizes ou hipermatrices de strings, das mesmas dimensões.

position

Possíveis valores :

'l' ou 'left' : justificação esquerda
'c' ou 'center': justificação centrada
'r' ou 'right' : justificação direita

Descrição

All heading and trailing spaces of T elements are removed before processing.

In each given column of TJ, all strings have the same length. Shorter strings are padded with spaces before, after, or on both sides.

The width may differ from a column to other ones. Please see the examples

Exemplos

m = ["a" "bcdef" "ghi" ; "jklm" "" "n" ; "opq" "rs" "tuvwxy"]
justify(m)
justify(m, "r")
justify(m, "c")
--> m = ["a" "bcdef" "ghi" ; "jklm" "" "n" ; "opq" "rs" "tuvwxy"]
 m  =
  "a"     "bcdef"  "ghi"
  "jklm"  ""       "n"
  "opq"   "rs"     "tuvwxy"

--> justify(m)
 ans  =
  "a   "  "bcdef"  "ghi   "
  "jklm"  "     "  "n     "
  "opq "  "rs   "  "tuvwxy"

--> justify(m, "r")
 ans  =
  "   a"  "bcdef"  "   ghi"
  "jklm"  "     "  "     n"
  " opq"  "   rs"  "tuvwxy"

--> justify(m, "c")
 ans  =
  " a  "  "bcdef"  " ghi  "
  "jklm"  "     "  "  n   "
  "opq "  " rs  "  "tuvwxy"

Ver Também

  • stripblanks — retira espaços em branco (e tabulações) no início ou no fim de strings
  • blanks — cria strings de caracteres em branco
  • length — Número de caracteres de um texto. Número de elementos de uma matriz ou lista.
  • part — extração de strings

Histórico

VersãoDescrição
2023.1 Hypermatrix accepted. The position becomes optional, with default = "left"
Report an issue
<< isnum Cadeias de Caracteres (Strings) length >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon May 22 12:42:14 CEST 2023