|
このページはEtoJ逐語翻訳フィルタによって翻訳生成されました。 |
Bookmark this on Delicious
Recommend to StumbleUpon
This tutorial will show you two ways to 負担 a StringGrid from a CSV text とじ込み/提出する. It was written to explain one of the 核心 elements used in a much bigger tutorial, vetting data in a CSV とじ込み/提出する. (The code should also work in Delphi.)
十分な sourcecode 供給するd, as usual. (A 十分な 名簿(に載せる)/表(にあげる)ing of the sourcecode is given at the 底(に届く) of this page.)
This page is 献身的な to the memory of the wonderful English actress Ann Emery, 1930-2016. I believe that her wonderful 現実化 of the 役割 of "Grandma", and the support she gave to all around her, 特に the children, were large parts of the phenomenal success of the 初めの London 生産/産物 of the musical "Billy Elliot".
You can see her as Grandma in the DVD of the show, "Billy Elliot Live".
I learned the sad news of her death while creating this page.
----------------------------------
Lazarus 供給するs a way to 負担 CSV とじ込み/提出するs. I would 推定する that Delphi does too. (If it doesn't, I believe that my way of 負担ing them would work there.) I'll show it to you.
So why 令状 another? I wrote it because I was misled by something I read in an 公式の/役人 言及/関連, late September 2016. I've kept, and am 促進するing, what I've done because I don't like an 面 of the "平易な" answer.
This might be a good time to download the zip とじ込み/提出する with the sourcecode for my CSV- to- StringGrid loader. It has a 収集するd .exe to play with.
That tries to 扱う/治療する what is in the とじ込み/提出する "TestDataLDN189.txt" as CSV, and to 負担 it into the StringGrid on the form. ("TestDataLDN189.txt" should be in the same folder as the .exe. Changing the 使用/適用 to 負担 a different とじ込み/提出する, from any 場所, would be trivial.)
Or you can just 診察する the sourcecode, below.
The 使用/適用 has two buttons, "負担 CSV with SheepdogGuides 決まりきった仕事" and "負担 CSV with Lazarus 決まりきった仕事". Click either one and what's in the StringGrid changes. If you want to see the results with different 実験(する) data, edit what is in TestDataLDN189.txt. (Or tweak the code わずかに, to let you choose a とじ込み/提出する.)
You will also find an "How To" guide, over at my Open Office tutorials, which covers using a CSV とじ込み/提出する consisting of 多重の 記録,記録的な/記録するs to append those 記録,記録的な/記録するs to a database (米)棚上げする/(英)提議する.
A quick "指名するing of parts", before we go on...
A CSV FILE is a collection of RECORDs, which are each made up of one or more FIELDS.
Example of two RECORDs:
フクロウ, Bird, Vertebrate 君主 バタフライ, Lepidoptera, Insect, Arthropod
The first 記録,記録的な/記録する has three fields, the second has four.
Within CSV とじ込み/提出するs, one line equals one 記録,記録的な/記録する. (What defines "a line" can be a problem in CSV work! Beware! I use Textpad (from Textpad.com) to create CSV とじ込み/提出するs. Notepad (basic Windows 使用/適用) 作品 just 同様に.)
Within a 記録,記録的な/記録する, a FIELD SEPARATOR 示すs where one field ends and the next begins. The comma has 伝統的に been used for this (CSV derives from COMMA Separated Values), but other characters, 含むing the 非,不,無-"printing" TAB character (ASCII 9) are often used. The field separator in the examples is a comma.
鮮明度/定義 of field separator character:In the Lazarus approach, you pass the field separator character to the 手続き. The SheepdogGuides 見解/翻訳/版 could have this feature 追加するd 極端に 簡単に. (Look at the code, search on "kFieldSep".)
------------------
多重の field separator characters:In the SheepdogGuides 見解/翻訳/版, only the 明示するd field separator is 扱う/治療するd as a field separator. In the Lazarus 見解/翻訳/版, spaces also count as separators. (支配する to the separator-as-data considerations we turn to in a moment.) So, in the SheepdogGuides 見解/翻訳/版, the に引き続いて 記録,記録的な/記録する has 4 fields, but in the Lazarus 見解/翻訳/版 it has 5, "君主" and "バタフライ" 存在 みなすd to be "separated".
君主 バタフライ, Lepidoptera, Insect, Arthropod
------------------
Separator-as-data: There is a way around "the problem.... in the Lazarus 見解/翻訳/版. With a 特別手当.
In the Lazarus 見解/翻訳/版, the に引き続いて has four fields...
"君主 バタフライ", Lepidoptera, Insect, Arthropod
(The SheepdogGuides 見解/翻訳/版, at 01 Oct 16, would also 扱う/治療する it as four fields, as it did before, but would 含む the quotation 示すs as part of the first field datum.)
その上に, the Lazarus 見解/翻訳/版 would even consider...
"君主 バタフライ, Orange", Lepidoptera, Insect, Arthropod
... to consist of four fields. It would "ignore" the comma inside....
君主 バタフライ, Orange
The SheepdogGuides 見解/翻訳/版, at 01 Oct 16, would consider the 記録,記録的な/記録する given to have five fields:
"君主 バタフライ Orange" Lepidoptera Insect Arthropod
The SheepdogGuides approach is いっそう少なく 柔軟な... and more predicable. I kept 説 "at 01 Oct 16", because I am tempted to 追加する the "enclose a thing in 引用するs, and it becomes one field, 関わりなく contents" feature, but it won't be happening any time soon.
There's a discussion of some of the whys and wherefors in the thread at http://会議.lazarus.freepascal.org which the link will take you to.
------------------
Number of 列/漕ぐ/騒動s: Both ways of reading the CSV resize the StringGrid to 含む/封じ込める as many 列/漕ぐ/騒動s as there are 記録,記録的な/記録するs in the CSV とじ込み/提出する. But...
------------------
Number of Columns: The Lazarus 見解/翻訳/版 始める,決めるs the number of columns to however many fields there are in the first 記録,記録的な/記録する. If a その後の 記録,記録的な/記録する has more, the data in the extra fields is just thrown away. (With both 見解/翻訳/版s, if a 記録,記録的な/記録する has より小数の fields than the StringGrid has columns, the corresponding 独房s are just left empty.)
The SheepdogGuides 見解/翻訳/版, at 01 Oct 16, is weak in this department... in three ways...
1) The programmer 決定するs the size of the StringGrid, at design time, in the LoadFileToStringGrid. If sgData.ColCount is 始める,決める to 7, the StringGrid will have 7 columns.
2) If sgData.ColCount has been 始める,決める to 7, and a 記録,記録的な/記録する with 8 fields is 遭遇(する)d, the 使用/適用 will not 答える/応じる 井戸/弁護士席. An error message is 現在のd to the 使用者, and the best bet would be to 終結させる the 使用/適用, 改訂する the CSV (or code), and re-run. I THINK this can be "直す/買収する,八百長をするd"... that's what the "OR (bColIndexL>8)" in StringToSGRow is all about. ("String To StringGrid ROW, by the way. Not a subroutine about anything "growing".)
3) Because of the "OR (bColIndexL>8)" just について言及するd, the SheepdogGuides 見解/翻訳/版, as at 01 Oct 16, can't 扱う 記録,記録的な/記録するs of lots of fields. The "8" was 選ぶd more or いっそう少なく at 無作為の. It has to be larger than (maybe "equal to" okay" the number you 割り当てるd to sgData.ColCount. When this code is More Better, I 嫌疑者,容疑者/疑う that the cure of one of these shortcomings will also cure the other. At the moment, the "problem" is not 厳しい if while you are 令状ing 使用/適用s with the code you know basic things about the CSV it will be working with. But it is untidy, I know.
------------------
Trimming: What about spaces at the start and end of anything else between the field separators?
In Lazarus, the 支配するs are a little コンビナート/複合体, because, remember, a space is itself a field separator. But, A THE ENDS of a field value, they are just 除去するd. Always. I think. ("A little コンビナート/複合体"?"君主 バタフライ, Insect" is three fields. Suppose there were three spaces between the 君主 and the バタフライ. Shouldn't that make the whole 記録,記録的な/記録する four fields, the second one 持つ/拘留するing a space? No, of course not, your HUMAN logic says. But it took some clever programming to get the computer to... in this 事例/患者... think like a human. And I dislike "clever programming". It is just easier to work with a "dumb" computer, not have it... いつかs... 存在 clever.)
In the SheepdogGuides 見解/翻訳/版, spaces can, throughout the field value, be "just another character", i.e. like a, b, c... 1, 2, %, $, etc... OR, if you wish, spaces before or after the 残り/休憩(する) of the field's value can be trimmed off. (In general, I think you will want to 削減する.)
In the SheepdogGuides 見解/翻訳/版, just 始める,決める the boTrimFields parameter of the StringToSGRow "String To StringGrid 列/漕ぐ/騒動" 手続き "true" to have the data arriving from the CSV "topped and tailed", as my Dorset "mother" referred to 準備するing string beans for the dinner (米)棚上げする/(英)提議する. Beware: If you DON'T 削減する, and have a 記録,記録的な/記録する like...
Aphid, Bug, Arthropod
... (that has a space after each comma, as is ありふれた practice in typing text)... then if you say...
if (second field value)='Bug' then showmessage('hi');
... it won't show "hi". Without trimming the second field's value would be "SPACE-B-u-g". Dumb computer. But CONSISTENT, and easily predictable computer.
------------------
No datum vs datum is "nothing": Here's a brain bender for you. It is along the lines of the old "if a man says "I can stop working now" five miles from the nearest woman, is he still wrong?"
What is the difference between a bank account for Joe Bloggs which has nothing in it, and the 状況/情勢 where Joe doesn't have the account? やめる 重要な, when you put it like that!
This comes up because when you "fill" a 4 column string grid with the fields in...
フクロウ,Bird,Vertebrate
... the last 独房 will be empty because you didn't put anything there.
... BUT!... If the 記録,記録的な/記録する was....
フクロウ,,Bird,Vertebrate ^ notice: two commas
... then you would be 説 "Put フクロウ in the first 独房, NOTHING in the second 独房, Bird in the third, and Vertebrate in the last.
いつかs a 独房 is empty because nothing was put there. いつかs it is empty because what was put there was "nothing". -*!*- (Re-read that, think about it!)
Arcane as it sounds, it 事柄s.
For instance... what if the 記録,記録的な/記録する is...
フクロウ,Bird,Vertebrate,
The above 記録,記録的な/記録する would be 扱う/治療するd by both methods of 負担ing CSV to a StringGrid as having FOUR fields, even though the contents of the last field is "nothing" (Which is something, if you see what I mean.)
In the SheepdogGuides 見解/翻訳/版, there's a remmed out line that you can 回復する to the code which will put "null" (or other text of your choosing) into any 独房 which had a "nothing" put in it, so you can tell which those 独房s were, vs the ones that were not 接近d at all. (Search on "then sOneField:='null'").
------------------
The last line: Does it 事柄 if, after the last printing character in the CSV, the person entering the data 圧力(をかける)d the Enter 重要な?
In the Lazarus 見解/翻訳/版, empty lines at the end of the CSV are ignored. It even ignores lines with just spaces. (But not a line with a comma).
The SheepdogGuides 見解/翻訳/版 will "see" the line created by each "enter", 追加する an empty 列/漕ぐ/騒動.
------------------
Column width 調整s: At one point, after the Lazarus 見解/翻訳/版 had 負担d all of the 記録,記録的な/記録するs into the StringGrid, it adjusted the width of each column to make it just wide enough for the longest 入ること/参加(者) in that column. It doesn't do that any more.
The Lazarus 見解/翻訳/版 was not doing any width adjusting at 01 Oct 16... which is a good thing, 奮起させるd me to change the SheepdogGuides 見解/翻訳/版.
Why "take out a feature"? Because it won't always be 手配中の,お尋ね者. And if you DO want the feature, be it for the Lazarus or SheepdogGuides way to fill the StringGrid, just call the StringGrid's "AutoSizeColumns" method, if you want the widths adjusted.
By the way... sorry... until I can get to 演説(する)/住所ing all the "問題/発行するs" of 直す/買収する,八百長をするd Columns (or 列/漕ぐ/騒動s) in a StringGrid, I have to ask you to 始める,決める those 所有物/資産/財産s to 無, if using my 負担 and Save. (In a nutshell: those columns ARE in the "独房s[x,y] world, just like all the other 独房s of the StringGrid... but they are OUTSIDE of what you can "reach" at run time with mouse clicks or arrow 重要なs.
The 関係のある propterties are usually 始める,決める to 無 or 1. When 始める,決める to 1, you get the things where column 肩書を与えるs/ 列/漕ぐ/騒動 numbers typically go, at the 最高の,を越す and on the left.
If you don't mind 負担ing and saving all of the 団体/死体 of your StringGrid AND the 直す/買収する,八百長をするd columns when you do a 負担 or save, you will be mostly okay. But if you 接近 the 独房s 直接/まっすぐに, by code, you'll have to be careful, or you may "do things" you didn't mean to to things in the (supposed to be) "直す/買収する,八百長をするd" columns/ 列/漕ぐ/騒動s.)
At 01 Oct 16, if you read about CSV stuff at http://wiki.freepascal.org/CsvDocument, it sounded like you had to "追加する stuff" to your basic Lazarus IDE.
For the CSV stuff discussed in this tutorial, you do not. (I was using Lazarus Vers #:1.0, with FPC 2.6.0, on a Windows 7 box.)
Go along to http://wiki.freepascal.org/Grids_Reference_Page for lots of good stuff about grids in general, which will help you work with StringGrids.
I hope this section doesn't grow much. It is for 半端物s and ends which have occured to me since 令状ing the code you see here.
It may be that a blank line in the とじ込み/提出する of 記録,記録的な/記録するs to be appended will 終結させる the 負担ing of 記録,記録的な/記録するs from that into this. I don't aspire to make my code idiot PROOF. Idiot 抵抗力のある will do. Rather than re-令状 the code, I will rely on 使用者s to notice the 不足(高), visit the CSV とじ込み/提出する, and 人物/姿/数字 out what is wrong and 直す/買収する,八百長をする it.
And so to the sourcecode! I try to keep in step what is here and what is in the .zip とじ込み/提出する with .exe, 見本 data, and 十分な sourcecode, forms とじ込み/提出するs, etc which you can download. いつかs they get out of step though. I would be 感謝する if you let me know of anything puzzling that you 遭遇(する). Maybe you can save the next person the hassle of scratching 長,率いるs?
部隊 ldn189u1;
{$mode objfpc}{$H+}
//This デモ 使用/適用, LDN_189, 論証するs 負担ing a
// StringGrid from a CSV とじ込み/提出する. LDN_189 is explained in
// https://sheepdogguides.com/lut/ltn4d.htm
//A much bigger 使用/適用, which uses the code in
// LDN_189, discusses using a StringGrid to 接近 a
// CSV とじ込み/提出する, make checks on the 有効性,効力 of data in that
// とじ込み/提出する (for instance, one field is checked to see if
// it 含む/封じ込めるs a valid abbreviation for a US 明言する/公表する. Any
// 無効の datum is 最高潮の場面d, and can be edited.)
//That 使用/適用 is discussed in the tutorial at...
// https://sheepdogguides.com/lut/ltn4c.htm
//N.B.: At the moment, there is a Kludge... search on
// bColIndexL>8
// ... to find it. It 限界s the number of fields which
// can be in a 記録,記録的な/記録する.
//Author's 公式文書,認めるs to himself: At 底(に届く).
interface
uses
Classes, SysUtils, FileUtil, Forms, 支配(する)/統制するs, Graphics, Dialogs, StdCtrls,
Grids, ClipBrd;
const vers='1 Oct 16';
//started 29 Sep 16, on road to an 使用/適用 to
// vett DVD 記録,記録的な/記録するs data.
kGridMaxXIndex=15;
kGridMaxYIndex=25;
type
{ Tldn189f1 }
Tldn189f1 = class(TForm)
buQuit: TButton;
buLoadSGWay: TButton;
buAdjColWidth: TButton;
buAbout: TButton;
buLoadLazWay: TButton;
buLinkToWeb: TButton;
sgData: TStringGrid;
手続き buAboutClick(Sender: TObject);
手続き buLinkToWebClick(Sender: TObject);
手続き buLoadSGWayClick(Sender: TObject);
手続き buQuitClick(Sender: TObject);
手続き buAdjColWidthClick(Sender: TObject);
手続き buLoadLazWayClick(Sender: TObject);
手続き FormCreate(Sender: TObject);
私的な
{ 私的な 宣言s }
手続き LoadFileToStringGrid(sFileName:string);
手続き StringToSGRow(sgLocal:TStringGrid;
sRawData:string;iRow:integer;boTrimFields:boolean);
public
{ public 宣言s }
end;
var
ldn189f1: Tldn189f1;
実施
{$R *.lfm}
{$R+}
{ Tldn189f1 }
手続き Tldn189f1.buQuitClick(Sender: TObject);
begin
の近くに;
end;
手続き Tldn189f1.buAdjColWidthClick(Sender: TObject);
begin
sgData.AutoSizeColumns;
end;
手続き Tldn189f1.buLoadLazWayClick(Sender: TObject);
begin
//This may be "simple", but, sadly, it 扱う/治療するs spaces as
//field separators, unless the whole field is
//enclosed in 引用するs. The last parameter has to do
//with whether there's a line of headers in the CSV
//
//This "answer" 始める,決めるs the number of columns in the
//StringGrid to the number of fields in the first
//記録,記録的な/記録する (and throws away "extras" on その後の
//lines.) (My "answer" WILL throw away extras, too,
//but, at 30 Sep 16, 始める,決める the number of columns
//crudely. (At 現在の, "extras" 原因(となる) problems.)
//
//My "answer" could be 高めるd to 始める,決める the number
//of colums as LoadFromCSVFile does.
//
//Both answers 扱う/治療する...
// My,Data,
//as a line with THREE fields, the last 持つ/拘留するing ''
//I.e. the third field is "nothing" which is DIFFERENT
//from "not 明示するd".
//
//I'm not sure that this would work in Delphi, or, if it
//does, will work 正確に/まさに as it does in Lazarus.
sgData.LoadFromCSVFile('TestDataLDN189.txt',',',true);
end;
手続き Tldn189f1.LoadFileToStringGrid(sFileName:string);
(*The とじ込み/提出する to be 負担d should consist of one or more
RECORDS, each consisting of one or more FIELDS.
The とじ込み/提出する should consist printable characters, 加える
(maybe) the code for TAB, and a FEW others like that.
The RECORDS are separated by CR/LF terminators,
FIELDS are separated by COMMAS. A line ending in
a comma is considered to 示す that the final
field of that 記録,記録的な/記録する had nothing in it, e.g.....
Three fields: Fred,Bloggs,860-767-5555
Four fields: Fred,Bloggs,860-767-5555,
*)
var
cardCounter:枢機けい/主要な;
stringsTmp:TStrings;
begin //LoadFileToStringGrid
stringsTmp:=TStringList.Create;
try
stringsTmp.LoadFromFile(sFileName);
sgData.RowCount:=stringsTmp.Count;//Yes: .count, not .count-1
sgData.ColCount:=7;//This CLUMSY... But could 公正に/かなり easily
//be 取って代わるd by code to count the fields in the first
//line, and make the StringGrid have that many columns.
//The "built in" LoadFromCSVFile does that. Both 決まりきった仕事s
//ignore the fact that a data とじ込み/提出する might have more
//fields in a その後の 記録,記録的な/記録する. (The extra fields are
//just thrown away in the LoadFromCSVFile. At 現在の,
//they 原因(となる) a problem (good! You'll know about them!)
//in this answer. (That can be 直す/買収する,八百長をするd.)
//What's done here, for the moment, is to 始める,決める, by 手渡す, something
//that 限界s how many fields there can be in any 記録,記録的な/記録する
//in the CSV とじ込み/提出する. 越える that 限界, and the 使用/適用
//shuts 負かす/撃墜する, in a messy way. 落ちる short of that on a given
//line, and you just have some empty 独房s at the 権利 手渡す
//end of the line.
//For the 未来: 追加する a parameter to LoadFileToStringGrid
//If 無: Use the "answer" used by LoadFromCSVFile, if
//> 無, 始める,決める ColCount from that. (If this is done, also
//供給する a "ざっと目を通す とじ込み/提出する, find out longest (most fields) 記録,記録的な/記録する"
//機能(する)/行事.)
//
//In any 事例/患者, 追加する a "var" variable to return error codes
//to 使用者.... "とじ込み/提出する not 設立する","too many fields 遭遇(する)d",
//etc.
//Also 追加する a parameter to 明示する the separator character.
//追加する a way to use.... "Bloggs, Fred",123 to 許す separator
// character inside a field? Make it optional, and tell
//使用者s that the 使用/適用 runs faster if they don't
//use the feature?
for cardCounter:= 0 to stringsTmp.Count-1 do begin
StringToSGRow(sgData,stringsTmp[cardCounter],cardCounter,true);
end;
//To be checked... what does app do when a)there is / b) there
// is not a CR at the end of the とじ込み/提出する? (Prelim checks: It doesn't
// 事柄. (^_^)
//If there is a last line consisting just of spaces, the Lazarus
// 見解/翻訳/版 does NOT 追加する a 列/漕ぐ/騒動 to the StringGrid, the
// SheepdogGuides 見解/翻訳/版 DOES 追加する a 列/漕ぐ/騒動
finally
stringsTmp.解放する/自由な;
end;//Try... finally
//Put.... sgData.AutoSizeColumns;
// ... in your code, after the call of LoadFileToStringGrid,
// if you would like all of the columns' widths adjusted,
// leaving each column just wide enough for the widest datum
// in the column.
end;//LoadFileToStringGrid
手続き Tldn189f1.StringToSGRow(sgLocal:TStringGrid;
sRawData:string;iRow:integer;boTrimFields:boolean);
var bColIndexL:byte;
sOneField:string;
boDoneIt:boolean;
//This 手続き is used within "LoadFileToStringGrid". You
// wouldn't be likely to want to call it 直接/まっすぐに.
//Takes, from sRawData, a string like...
// 860-555-1912,CT,Joe Smith
//... and puts the three fields in the first three
//colums of StringGrid sgLocal.
//What's in sRawData is "eaten away" over the course of the 手続き.
//If boTrimFields is true, then spaces at either end of the field datum
// are trimmed off....
// " 見本 datum "
// ... would become...
// "見本 datum"
機能(する)/行事 boChomp(var sSource:string;
var sDest:string):boolean;//SR of StringToSGRow
//N.B. BOTH PARAMS ARE *var* PARAMS... contents of the
//variables used to "料金d" this SR will be changed by
//the 死刑執行 of the 手続き.
//
//The contents of sDest before the call are irrelevant.
//
//If the string passed to sSource has a comma at it's
// 権利 手渡す end, then the 決まりきった仕事 assumes that to mean
// that there is a field after the comma, but that the
// contents of that field just happen to be "nothing",
// i.e. ''. In the 過程ing of such a string, sSource
// will be passed 支援する to the calling program with a
// rogue value, just before the call of Chomp which
// "reads" the "empty" field.
//In other words... string "a" has three fields,
// string "b" has FOUR...
// a) Fred,Bloggs,860-767-5555
// b) Fred,Bloggs,860-767-5555,
// ---^---
var iPosOfComma:integer;
const kFieldSep=',';//Rewrite to 供給(する) this in
//a parameter, if you feel having that
//flexiblity is important to you.
begin //main 封鎖する of boChomp, SR of StringToSGRow
if sSource='' then result:=true//no ; here
//(See "N.B. bChomp returns...", below. THIS "true"
//arises if you call Chomp when there was no point...
//you already knew there was no more data to parse.
else begin //1 (Use last field in string that started
//String1, String2, .... , StringLast
//(There will be no comma after last field.)
//N.B. boChomp returns 誤った until there is no more
// data to be 収穫d by a その上の call of Chomp.
//公式文書,認める 特に... the first time it
// returns TRUE, there is STILL one field to be
// USED by the calling program. It has been
// returned to the calling program in sDest,
// as usual.
if sSource='tkbRogueToIndicateNullFieldAtEndOfRaw' then
sSource:='';
iPosOfComma:=pos(kFieldSep,sSource);
if iPosOfComma=0 then begin //2
//The "=1" 事例/患者 arises if the string you are
//chomping ends with a comma, which is 解釈する/通訳するd
//as meaning that there IS one more field in the
//string, but it just happens to consist of nothing,
//just happens to be ''}
sDest:=sSource;
sSource:='';
result:=true;//(See "N.B. bChomp returns..." THIS "true"
//is for the 事例/患者 where you have just 収穫d the last
//field from the string you have been "chomping" through.
end//no ; here. End of "then 2"
else begin //2
if iPosOfComma=length(sSource) then
sSource:=sSource+'tkbRogueToIndicateNullFieldAtEndOfRaw';
sDest:=copy(sSource,1,iPosOfComma-1);
sSource:=copy(sSource,iPosOfComma+1,length(sSource));
result:=誤った;
end;//of "else 2"
end;// of "else 1"
end;//boChomp, SR of StringToSGRow
begin //main 封鎖する of StringToSGRow
bColIndexL:=0;
boDoneIt:=誤った;
repeat
boDoneIt:=boChomp(sRawData,sOneField);//N.B: These are "var"
//parameters. A bit is chopped off of sRawData, and
//sOneField is filled with a new value. Also: You can
//ignore compiler 警告 about sOneField not 存在
//initialized.
if boTrimfields then sOneField:=削減する(sOneField);
//If you want to "see something" when a field in the
// CSV says "nothing, here", de-rem the に引き続いて...
//if sOneField='' then sOneField:='null';
sgLocal.独房s[bColIndexL,iRow]:=sOneField;
inc(bColIndexL);
until (boDoneIt) OR (bColIndexL>8);//second 称する,呼ぶ/期間/用語 to be 精製するd in
//予定 course... at 現在の, it is a kludge... but it WILL have
//a 役割 to play one day. Keep 公式文書,認める at 最高の,を越す of code in step.
//(結局, before LoadFileToStringGrid,
//is called, somehow a 決意 will be made as to how many
//columns are to be filled. If, by chance or error, the CSV とじ込み/提出する
//has a 記録,記録的な/記録する with too many fields, at the moment problems arise.
//When the "8" is 取って代わるd by a variable, and that is 負担d to
//反映する how big the StringGrid 利用できる is, then steps can be
//taken to 取引,協定 nicely with a "too big for the 列/漕ぐ/騒動" 記録,記録的な/記録する from
//the CSV とじ込み/提出する.
end;//StringToSGRow
手続き Tldn189f1.FormCreate(Sender: TObject);
begin
ldn189f1.caption:='LDN189- 負担 CSV into StringGrid- ver: '+vers;
使用/適用.肩書を与える:='LDN189';
end;
手続き Tldn189f1.buLoadSGWayClick(Sender: TObject);
begin
LoadFileToStringGrid('TestDataLDN189.txt');
end;
手続き Tldn189f1.buAboutClick(Sender: TObject);
begin
showmessage('This is one of many 使用/適用s '+
'利用できる from https://sheepdogguides.com/Lut/'+chr(13)+
'... a collection of Lazarsus and Delphi tutorials.');
end;
手続き Tldn189f1.buLinkToWebClick(Sender: TObject);
begin
Clipboard.AsText:='https://sheepdogguides.com/lut/lt4Nd.htm';
end;
(*Author's 公式文書,認めるs to himself...
LDN_189 derived from LDN_190, itself derived from LDN191!
LDN_191 is a コンビナート/複合体 使用/適用 illustrating Doing Clever
Things with a StringGrid 反対する. Sadly, at it's heart,
30 Sep 16, the code for the basic 負担ing of the
StringGrid from data in a CSV とじ込み/提出する was 欠陥d. I am
01 Oct 16, working on 直す/買収する,八百長をするing that.
LDN_189 is a デモ for the new, working (I hope!) 核心
"負担 CSV to StringGrid", believed to be 公正に/かなり sound.
It デモs two ways to do the 職業.
Where LDN_191 says/ said...
sgData.列/漕ぐ/騒動s[I-1].CommaText := CSV[I-1];
.... needs (needed? Maybe the changes have been made,
since this was written?)... needs to be changed to...
StringToSGRow(sgData,CSV[I],I,true);
... and the code to support that needs to be 追加するd.
*)
end.
Search across all my 場所/位置s with the Google search...
|
|
Page 実験(する)d for 同意/服従 with INDUSTRY (not MS-only) 基準s, using the 解放する/自由な, 公然と accessible validator at validator.w3.org. Mostly passes. There were two "unknown せいにするs" in Google+ button code. Sigh.
....... P a g e . . . E n d s .....