掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
Trim関数で大文字スペースもTrim対象にしたい (ID:14326)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
皆様、色々ご指導ありがとうございます。 こんなんが出来ました。 早速テストしてみます。 function TrimMB(const S: string): string; var tmpS: String; begin tmpS := S; while (Copy(tmpS, 1, 1) = ' ') and (Copy(tmpS, 1, 2) = ' ') do begin if Copy(tmpS, 1, 1) = ' ' then tmpS := Copy(tmpS, 2, Length(tmpS)); if Copy(tmpS, 1, 2) = ' ' then tmpS := Copy(tmpS, 3, Length(tmpS)); end; while (Copy(tmpS, Length(tmpS), 1) = ' ') and (Copy(tmpS, Length(tmpS) -1, 2) = ' ') do begin if Copy(S, Length(S), 1) = ' ' then S := Copy(S, 1, Length(S) - 1); if Copy(S, Length(S) - 1, 2) = ' ' then S := Copy(S, 1, Length(S) - 2); end; Result := tmpS; end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.