Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Packages and Libraries
»
Output all keys and values from TFPGMap
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
QGradientTrackPanel: A Fu...
by
Boleeman
[
Today
at 07:13:07 am]
[closed] Is case for stri...
by
egsuh
[
Today
at 06:39:17 am]
New charts
by
Boleeman
[
Today
at 04:26:40 am]
Unleashed Pascal (async/a...
by
Akira1364
[
Today
at 02:24:26 am]
Fast Canvas Library V1.05...
by
Gigatron
[
Today
at 01:28:23 am]
How to define the SQLite3...
by
jamie
[
Today
at 01:26:49 am]
kOmniXML for Lazarus and ...
by
PeterEvans
[
Today
at 01:11:14 am]
Finding List of Fonts & P...
by
J-G
[August 09, 2026, 11:05:31 pm]
[Scrubbed] Question about...
by
jamie
[August 09, 2026, 08:47:34 pm]
Bug: XLSX writer does not...
by
wp
[August 09, 2026, 08:29:22 pm]
New Big Integer library i...
by
ad1mt
[August 09, 2026, 05:32:14 pm]
Star Wars Galaxian
by
Thausand
[August 09, 2026, 04:47:51 pm]
Automatic generation of *...
by
PeterBB
[August 09, 2026, 01:38:51 pm]
TyControls: a custom-draw...
by
Antek
[August 09, 2026, 12:07:39 pm]
PO-Editor MyLangEdit3 now...
by
dbannon
[August 09, 2026, 07:55:47 am]
Application triggers mess...
by
JanRoza
[August 09, 2026, 12:26:52 am]
[solved] form reset/reloa...
by
ADMGNS
[August 08, 2026, 09:58:42 pm]
Create small language
by
ADMGNS
[August 08, 2026, 09:52:19 pm]
Advatage Database server
by
neobrasil08
[August 08, 2026, 08:42:18 pm]
How get listy of FieldDat...
by
Aruna
[August 08, 2026, 04:02:16 pm]
Identify network devices
by
LemonParty
[August 08, 2026, 03:44:03 pm]
how to connect to mariadb...
by
Mike.Cornflake
[August 08, 2026, 12:25:31 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Output all keys and values from TFPGMap (Read 623 times)
LemonParty
Hero Member
Posts: 596
Output all keys and values from TFPGMap
«
on:
October 09, 2025, 07:33:46 pm »
Hello.
I want to output all keys and values from TFPGMap. How can I do that?
Logged
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11
cdbc
Hero Member
Posts: 2921
Re: Output all keys and values from TFPGMap
«
Reply #1 on:
October 09, 2025, 07:56:32 pm »
Hi
Does it have an 'Iterate' method, then use that...
It usually requires you to provide a procedure or method to call for each item in the map...
Maybe it's called 'ForEach'... that would be the same M.O. as above.
Regards Benny
eta: Forget iterating that list or its ancestors...! Just had a look
«
Last Edit: October 09, 2025, 08:10:01 pm by cdbc
»
Logged
If it ain't broke, don't fix it
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release & FPC Main -> Lazarus Main
Thausand
Hero Member
Posts: 588
Re: Output all keys and values from TFPGMap
«
Reply #2 on:
October 09, 2025, 08:19:25 pm »
Quote from: LemonParty on October 09, 2025, 07:33:46 pm
I want to output all keys and values from TFPGMap. How can I do that?
Code: Pascal
[Select]
[+]
[-]
program
test
;
{$mode objfpc}{$h+}
uses
sysutils
,
fgl
;
type
TAMap
=
specialize TFPGMap<
string
,
integer>
;
var
Map
:
TAMap
;
n
,
i
:
integer
;
begin
Map
:
=
TAMap
.
Create
;
for
n
:
=
1
to
100
do
Map
.
Add
(
n
.
ToString
,
n
*
2
)
;
for
i
:
=
0
to
Map
.
Count
-
1
do
writeln
(
Map
.
Keys
[
i
]
,
' -> '
,
Map
.
Data
[
i
]
)
;
Map
.
Free
;
end
.
Logged
A docile goblin always follow HERMES.md
LemonParty
Hero Member
Posts: 596
Re: Output all keys and values from TFPGMap
«
Reply #3 on:
October 10, 2025, 02:26:44 pm »
It works. Thank you.
Logged
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Packages and Libraries
»
Output all keys and values from TFPGMap
TinyPortal
© 2005-2018