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
Variable "xyz" doesn't no...
by
Bitbeisser
[
Today
at 12:27:32 am]
AArch64. Slow program sta...
by
dbannon
[
Today
at 12:14:29 am]
Unit Masks, matches funct...
by
Martin_fr
[November 12, 2025, 11:05:23 pm]
Groupview uprgrade comple...
by
matthius
[November 12, 2025, 09:34:32 pm]
Minimum and maximum value...
by
dsiders
[November 12, 2025, 09:05:00 pm]
Playing video without to ...
by
Pe3s
[November 12, 2025, 09:02:55 pm]
Lazarus Bugfix Release 4...
by
Martin_fr
[November 12, 2025, 08:28:30 pm]
Lazarus Blowfish
by
BSaidus
[November 12, 2025, 07:53:39 pm]
[SOLVED] Feature request:...
by
Hansaplast
[November 12, 2025, 06:59:18 pm]
Problem Installing CHM He...
by
Curt Carpenter
[November 12, 2025, 06:38:10 pm]
(SOLVED)Is There a Manner...
by
Guva
[November 12, 2025, 06:33:35 pm]
Help with search and repa...
by
Zvoni
[November 12, 2025, 05:31:00 pm]
Valgrind stops showing li...
by
Martin_fr
[November 12, 2025, 04:55:56 pm]
Postgres, ZEOS and Visual...
by
calebs
[November 12, 2025, 03:21:27 pm]
TPairSplitterSide cannot ...
by
CM630
[November 12, 2025, 02:52:37 pm]
Porting PDF Viewer from D...
by
domasz
[November 12, 2025, 11:43:17 am]
ATSyntEdit dependency fai...
by
AlexTP
[November 12, 2025, 10:08:55 am]
Anyone interested in help...
by
ad1mt
[November 12, 2025, 09:59:03 am]
Heap Overflow with millio...
by
Martin_fr
[November 12, 2025, 09:04:58 am]
updated pc but.. worse
by
Thaddy
[November 12, 2025, 06:11:57 am]
Fpcupdeluxe
by
Josh
[November 12, 2025, 12:01:05 am]
Getting a true variant pa...
by
440bx
[November 11, 2025, 11:41:22 pm]
jBitmap rotation
by
neuro
[November 11, 2025, 10:01:43 pm]
Google Play Store require...
by
nobody.00
[November 11, 2025, 07:34:30 pm]
Bindings for PlutoVG
by
CynicRus
[November 11, 2025, 04:49:28 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Output all keys and values from TFPGMap (Read 302 times)
LemonParty
Sr. Member
Posts: 367
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: 2466
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 -> FPC 3.2.2 -> Lazarus 4.0 up until Jan 2025 from then on it's both above &: KDE6/QT6 -> FPC 3.3.1 -> Lazarus 4.99
Thausand
Sr. Member
Posts: 396
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
LemonParty
Sr. Member
Posts: 367
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