掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
空白のあるcsvファイルをStringGridに取り込むには? (ID:15800)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
横ヤリ失敬 別の方法 半角スペースを、区切りとしないで読み込む関数 中身は、ほとんどTStrings.CommaTextと同じ;-) TStrings.CommaTextのかわりに使う。 例) StringList.CommaText := HogeHoge; ↓ SetCommaTextToStrings(StringList, HogeHoge); procedure SetCommaTextToStrings(aStrings: TStrings; const aValue: String); {','区切り文字列} var p, p1: PChar; s: string; begin aStrings.BeginUpdate; try aStrings.Clear; p := PChar(aValue); while p^ in [#1..#$1F] do p := CharNext(p); while p^ <> #0 do begin if p^ = '"' then s := AnsiExtractQuotedStr(p, '"') else begin p1 := p; while (p^ > #$1F) and (p^ <> ',') do p := CharNext(p); SetString(s, p1, p - p1); end; aStrings.Add(s); while p^ in [#1..#$1F] do p := CharNext(p); if p^ = ',' then begin repeat p := CharNext(p); until not (p^ in [#1..#$1F]); end; end; finally aStrings.EndUpdate; end; end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.