データセットの列名から先頭文字(::)と終了文字(;;)を削除する方法ねえ、最初に::のような特定の記号を削除する方法を教えてください;;可能な場合は、列名の最後に。
例:
:: ColumnName ;; -> ColumnName
:: ColumnName :: XYZ; ABC ;; -> ColumnName :: XYZ; ABC
123::ColumName->変更なし123::ColumbiaName
データ表スクリプティングウィンドウズRe:データセットの列名から先頭文字(::)と終了文字(;;)を削除する方法これがあなたが望むことをする簡単なスクリプトです
Names Default To Here( 1 );
dt = Current Data Table();
For( i = 1, i <= N Cols( dt ), i++,
theName = Column( dt, i ) << get name;
If( Left( theName, 2 ) == "::",
theName = Substr( theName, 3 )
);
If( Right( theName, 2 ) == "::",
theName = Substr( theName, 1, Length( theName ) - 2 )
);
Column( dt, i ) << set name( theName );
);
Re:データセットの列名から先頭文字(::)と終了文字(;;)を削除する方法名前を作成するための追加オプションのカップル
// Option1, using Starts With, Ends With and Substr
If(Starts With(col_name, "::"),
col_name = Substr(col_name, 3);
);
If(Ends With(col_name, ";;"),
col_name = Substr(col_name, 1, Length(col_name) - 2);
);
これがすべての場合に機能するかどうかわからない
// Option2, using Regex
regex_pattern = "(?:^::)(.*)(?:;;$)";
Regex(col_name, regex_pattern, "\1");