Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Free Pascal
»
Beginners
(Moderators:
FPK
,
Tomas Hajny
) »
StrComp problem(Solved)
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
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
bug in FpWait?
by
marcov
[
Today
at 06:28:46 pm]
Changes in "Search Result...
by
Martin_fr
[
Today
at 06:18:46 pm]
Force Picklist in TString...
by
bruce.button
[
Today
at 06:10:15 pm]
Highlighting row in TSTri...
by
bruce.button
[
Today
at 06:07:43 pm]
Access violation with use...
by
Martin_fr
[
Today
at 06:06:51 pm]
[SOLVED] discarding an ar...
by
robert rozee
[
Today
at 05:25:52 pm]
The form designer works i...
by
JuhaManninen
[
Today
at 04:23:31 pm]
IDE shows wrong Error Mes...
by
Hartmut
[
Today
at 03:42:19 pm]
Any way to intercept stdo...
by
rishav
[
Today
at 03:13:23 pm]
Getting Started
by
Manlio
[
Today
at 02:44:35 pm]
IInterface issues, compil...
by
jamie
[
Today
at 02:10:29 pm]
How to make a T[Flow]Pane...
by
pleumann
[
Today
at 01:55:34 pm]
CRT unit kills Ctrl-C - S...
by
Warfley
[
Today
at 01:44:09 pm]
fphttpclient. set path op...
by
xinyiman
[
Today
at 01:41:24 pm]
help exporting 2 data col...
by
howardpc
[
Today
at 01:37:57 pm]
Cannot connect to MariaDB...
by
Tomki
[
Today
at 01:28:05 pm]
TDBGrid extended like Acc...
by
ttomas
[
Today
at 01:13:26 pm]
Kubuntu: No dark theme in...
by
Fungus
[
Today
at 12:58:01 pm]
How can I capture all key...
by
jamie
[
Today
at 12:25:13 pm]
Online Package Manager
by
d.ioannidis
[
Today
at 12:16:19 pm]
help choosing laptop
by
Leledumbo
[
Today
at 12:15:41 pm]
FileOpenDialog crashes/fr...
by
Martin_fr
[
Today
at 11:55:36 am]
Actions and Reslts
by
wp
[
Today
at 11:13:35 am]
Does FPC uses any interme...
by
MarkMLl
[
Today
at 10:29:28 am]
(Solved) Hex2Dec, strange...
by
arneolav
[
Today
at 10:02:02 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: StrComp problem(Solved) (Read 269 times)
JLWest
Hero Member
Posts: 1293
StrComp problem(Solved)
«
on:
April 01, 2023, 01:32:45 am »
Trying to compare two strings;
I don't understand what wrong with this.
Didn't know it mattered.
It compiled. I haven't tested it yet.
Sometimes just sName=sTag works and sometimes not. Wonder why?
Code: Pascal
[Select]
[+]
[-]
VAR
P1
:
PChar
;
P2
:
PChar
;
C
:
SizeInt
;
aName
,
aTag
:
String
;
begin
P1
:
=
sName
;
<<<duplicates
.
pas
(
243
,
10
)
Error
:
Incompatible types
:
got "AnsiString" expected "PChar"
p2
:
=
sTag
;
C
:
=
strcomp
(
P1
,
P2
)
;
«
Last Edit: May 11, 2023, 01:07:26 am by JLWest
»
Logged
FPC 3.2.0, Lazarus IDE v2.0.4
Windows 10 Pro 32-GB
Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB
KodeZwerg
Hero Member
Posts: 1399
Fifty shades of code.
Re: StrComp problem
«
Reply #1 on:
April 01, 2023, 01:36:55 am »
I do not know why you hide your declaration of sName, anyway, "P1 := PChar(sName);" should solve your issue.
Logged
«
Last Edit:
Tomorrow
at 31:76:97 by
KodeZwerg
»
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Free Pascal
»
Beginners
(Moderators:
FPK
,
Tomas Hajny
) »
StrComp problem(Solved)
TinyPortal
© 2005-2018