We help IT Professionals succeed at work.

Get coordinate

tyfing
tyfing asked
on
assuming my client app send the coordinates' 120, 110 ' to my server app. how do i make my server app show the coordinates separately in 2 editboxes. like editbox1 showing the x-coord (120) and editbox2 showing the y-coord (110). the client side is ok, i just need help at the server side
Comment
Watch Question

Assuming only your format, its say, two numbers separated with commas, thats the answer:

You need for testing:
One form
One button
Two Tedit controls.

procedure TForm1.Button1Click(Sender: TObject);
var
mYstring:string;
mYpos:integer;
len:Integer;

begin
mYString:='1234,567';
len:=Length(Mystring);
MYpos:=Pos(',',mystring);
Edit1.text:=copy(mystring,1,mypos-1);
Edit2.text:=copy(mystring,mypos+1,len - myPos);
end;

Author

Commented:
can u briefly explain it ? i don understand
procedure TForm1.Button1Click(Sender: TObject);
var
mYstring:string;
mYpos:integer;
len:Integer;

begin
mYString:='1234,567'; //This are the coordenate
len:=Length(Mystring); //here extract length of the string
MYpos:=Pos(',',mystring);// MYPos:= the comma position
Edit1.text:=copy(mystring,1,mypos-1);
//Copy mystring from 1 to mypos-1 its say 1 position before the comma, for not copy the comma.


Edit2.text:=copy(mystring,mypos+1,len - myPos);
//Secon number starts just after the comma then I copy from
mypos +1, its say after the comma, from the first number after the comma, how many numbers to copy, the len of the string minus myPos, the comma position.

the comma is the fifth character in the string the function Pos returns where the comma is (5).

.....

Explore More ContentExplore courses, solutions, and other research materials related to this topic.