[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

String conversion

Is there a way I can convert a string as in this example:
Help (converted to) help

Thanks
0
xpher
Asked:
xpher
  • 3
1 Solution
 
mikelittlewoodCommented:
function TForm1.StringConvert(s: String): String;
var
  iLoop: Integer;
begin
  Result := '';
  for iLoop := 1 to Length(s) do
    Result := Result + '&&#' + IntToStr(Ord(s[iLoop])) + ';';
end;

procedure TForm1.Show(Sender: TObject);
var
  s: String;
begin
  s:= StringConvert'help')
end;
0
 
mikelittlewoodCommented:
Sorry missed off a bracket

s:= StringConvert('help')
0
 
dygjCommented:
use  ord.

var
i:integer;
s:string;
begin
edit2.Text:='';
s:=edit1.Text;  // edit1.text:='HELP'
for i:=1 to length(s) do
edit2.Text:=edit2.text+inttostr(ord(s[i]));
end;

end;
//This one convert HELP to 104101108112.


Bjarte Dyngjeland

0
 
xpherAuthor Commented:
Thanks for that (only needs one & by the way)
0
 
mikelittlewoodCommented:
I just worked out why I thought I needed 2 x &
I passed the string to a showmessage so I could see what the result was.
If you dont have the second & it shows the message with the first & underlined.
Should have just passed the result to a visual component.

Glad I could help
0

Featured Post

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.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now