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
Generic array of records ...
by
domasz
[
Today
at 06:26:29 pm]
Is changing name supposed...
by
Martin_fr
[
Today
at 06:24:56 pm]
Screen.Cursor does not wo...
by
han
[
Today
at 05:50:29 pm]
IDE shows wrong Error Mes...
by
Hartmut
[
Today
at 05:38:28 pm]
Ms word
by
metis
[
Today
at 04:47:19 pm]
How to download a file fr...
by
maurobio
[
Today
at 03:57:58 pm]
Feature announcement: Fun...
by
Peter H
[
Today
at 02:33:31 pm]
DBEdit - display setting ...
by
Nicole
[
Today
at 02:30:36 pm]
DBGrid icon
by
paweld
[
Today
at 02:13:11 pm]
Another Hunspell Wrapper ...
by
dbannon
[
Today
at 01:57:31 pm]
is it possible to create ...
by
TRon
[
Today
at 01:49:28 pm]
Reverse order of an array
by
Thaddy
[
Today
at 01:17:41 pm]
Access violation with use...
by
Martin_fr
[
Today
at 01:03:02 pm]
How to filter when using ...
by
wp
[
Today
at 12:01:15 pm]
python for lazarus
by
Jurassic Pork
[
Today
at 09:36:33 am]
United OpenLib of Sound (...
by
net1999
[
Today
at 08:14:45 am]
Hello some example of nes...
by
eldonfsr
[
Today
at 03:42:05 am]
Screen draws very slow un...
by
TheMouseAUS
[
Today
at 01:47:13 am]
Browser as a view using W...
by
delphius
[June 09, 2023, 11:18:50 pm]
convert char of ansistrin...
by
toby
[June 09, 2023, 11:02:31 pm]
Lazarus 2.2.6 and anchord...
by
Martin_fr
[June 09, 2023, 10:49:49 pm]
Why is a private type of ...
by
PascalDragon
[June 09, 2023, 10:30:51 pm]
program locks up using se...
by
PascalDragon
[June 09, 2023, 10:15:10 pm]
Suggestion on the lines o...
by
Remy Lebeau
[June 09, 2023, 09:19:08 pm]
.cvd ClamAV database comp...
by
af0815
[June 09, 2023, 05:49:18 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: StrComp problem(Solved) (Read 280 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: 1405
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