Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.1.0 - 日本語


justify

スペースで補完された各列の文字列を、左、中央、右のいずれかに揃える

呼び出し手順

TJ = justify(T, position)

引数

T, TJ

同じ大きさの文字列のベクトル, 行列または超行列.

position

オプションのパラメータで、以下の値のいずれかを指定します:

'l'または'left': 左揃え (デフォルトモード)
'c'または'center': 中央揃え
'r'または'right': 右揃え

説明

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

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"

参照

  • stripblanks — 文字列の先頭または末尾の空白(およびタブ)を取り除く
  • blanks — 空白文字からなる文字列を作成する
  • length — オブジェクトの長さ
  • part — 文字列の展開

履歴

バージョン記述
2023.1 Hypermatrix accepted. The position becomes optional, with default = "left"
Report an issue
<< isnum Strings length >>

Copyright (c) 2022-2024 (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 Jun 17 17:54:19 CEST 2024