TStringList/pl: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: TStringList/pl
| Old | New | Line | |
|---|---|---|---|
| 1 | + | **TStringList** to [[Data type|typ danych]], który może przechowywać listę ciągów o dowolnej długości. Ciągi w TStringList są dostępne jako połączony zwykły tekst lub jako seria ciągów. Dostępna jest również funkcjonalność pary klucz-wartość. | |
| 2 | + | ||
| 3 | + | Dziedziczenie | |
| 4 | + | ||
| 5 | + | - [[TObject]] - Podstawowa [[Class|klasa]] dla wszystkich klas. | |
| 6 | + | - [[TPersistent]], [[IFPObserved]] - Podstawowa klasa dla systemu przesyłania strumieniowego i właściwości stałych - Interfejs zaimplementowany przez obiekt, który można obserwować. | |
| 7 | + | - [[TStrings]] - Klasa do zarządzania tablicami lub kolekcjami ciągów | |
| 8 | + | - **TStringList** - Standardowa implementacja klasy TStrings. | |
| 9 | + | ||
| 10 | + | TStringList dodaje funkcjonalność sortowania do [[TStrings]], poprzez dodanie właściwości `Sorted`, `Duplicates` i [[case-sensitive|CaseSensitive]] oraz [[Method|metody]] takie jak `Find`, aby ułatwić przyspieszone wyszukiwanie na liście. | |
| 11 | + | ||
| 12 | + | Przykład | |
| 13 | + | ||
| 14 | + | ``` pascal | |
| 15 | + | // pobierz wartość z pliku FILNAM wypełnionego parami klucz = wartość | |
| 16 | + | function GetValueFromFile( filnam: string, key: string ): string; | |
| 17 | + | var | |
| 18 | + | lst: TStringList; | |
| 19 | + | v: String; | |
| 20 | + | begin | |
| 21 | + | lst := TStringList.Create(); | |
| 22 | + | lst.CaseSensitive := false; | |
| 23 | + | lst.Duplicates := dupIgnore; // nie dodawaj duplikatów | |
| 24 | + | lst.Sorted := true; | |
| 25 | + | lst.LoadFromFile( filnam ); | |
| 26 | + | v := lst.Values[ key ]; | |
| 27 | + | lst.Free(); | |
| 28 | + | result := v; | |
| 29 | + | end; | |
| 30 | + | ``` | |
| 31 | + | ||
| 32 | + | ## Zobacz taże | |
| 33 | + | ||
| 34 | + | - [[doc:rtl/classes/tstringlist.html|TStringList doc]] | |
| 35 | + | - [[TStringList-TStrings Tutorial/pl|Samouczek TStringList-TStrings]] | |
| 36 | + | ||
| 37 | + | --- | |
| 38 | + | *From the Free Pascal wiki, page "TStringList/pl", as it stood on 2020-08-26 after a change by Slawek, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
