Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

string to Char coonversion

Posted on 1997-12-14
8
Medium Priority
?
6,893 Views
Last Modified: 2012-05-04
is there any way to convert "D" as a string type into "D" as a char type with Delphi 3?
0
Comment
Question by:arint
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 

Author Comment

by:arint
ID: 1353576
Edited text of question
0
 
LVL 4

Expert Comment

by:itamar
ID: 1353577
What about ?

var
  St : String;
  Ch : PChar;
begin
  Ch := PChar(St);
  ...
end;

0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1353578
itamar's answer will convert string to PChar.  If you want to convert string to Char, try this:

var
  c: PChar;
  s: string;
begin
  c := ' ';
  if (Length(s) > 0) then
    c := @s[1];
  ...
end;

JB
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Expert Comment

by:JimBob091197
ID: 1353579
P.S.  Should read
    c := s[1];
NOT
    c := @s[1];

JB
0
 
LVL 1

Accepted Solution

by:
aluiken earned 50 total points
ID: 1353580
yeah sure

Procedure WhatEver(S : String);
Var Ch : Char;
Begin
 Ch := S[1];
End;

now ch will contain the first char of string <S>

thats it,

regards Arijan
0
 
LVL 4

Expert Comment

by:itamar
ID: 1353581
HEI !

Isn't this "proposed answer" the JimBob's comment put as an answer ?? :<
0
 
LVL 1

Expert Comment

by:aluiken
ID: 1353582
yeah but if you leave the question open it's easy point's !!
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1353583
You clearly have a good idea of the spirit in which Experts Exchange is run...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question