掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
文字列から「年月日 日時」だけを取り出したい。 (ID:38059)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
頭とお尻からそれぞれ数字が現れるまで削っていくという方針で 例えばこんなのはどうでしょう。 function trim_date(const str: String): String; var stpos, edpos: Integer; begin stpos := 1; while (stpos <= Length(str)) and not (str[stpos] in ['0'..'9']) do Inc(stpos); edpos := Length(str); while (edpos > stpos) and not (str[edpos] in ['0'..'9']) do Dec(edpos); Result := Copy(str, stpos, edpos - stpos + 1); end; 「あと15分で2010-03-15 00:00:00になります」みたいに余計な数字が入っていると駄目ですけど。
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.