Ver Mensaje Individual
  #4  
Antiguo 04-02-2010
Alejo15x Alejo15x is offline
Miembro
 
Registrado: ene 2010
Posts: 55
Reputación: 17
Alejo15x Va por buen camino
Resuelto!

Gracias al duilioisola ese tambien funciona!
Pero este es mas facil:

function MySplit(source : string; delimiter : string): TStringList;
var i : integer;
s : string;
arrString: TStringList;
begin
arrString := TStringList.Create;
s := '';
i := 1;
repeat
begin
if Copy(source,i,Length(delimiter)) <> delimiter then
begin
s := s + Copy(source,i,1);
i := i + 1;
end
else
begin
arrString.Add(s);
s := '';
i := i + Length(delimiter);
end;
end
until i > Length(source);
if s <> '' then arrString.Add(s);
result := arrString;
end;

Código Delphi [-]
var
  arrWaypoint: TStringList;
  sList,Waypoint,sMode: string;
  posX,posY,posZ: string;
begin
  Waypoint := "Ground (1000 1450 7)"; 
 
  arrWaypoint := MySplit(Waypoint," ");
 
  sMode:= arrWaypoint.Strings[0]; // Returns "Ground"
 
  arrWaypoint := MySplit(Waypoint, "("); // These two lines are removing the brackets and "Ground" ...
  arrWaypoint := MySplit(arrWaypoint.Strings[1], ")"); // Only leaving "1000 1450 7"
 
  sList := arrWaypoint.Strings[0]; // = "1000 1450 7"
 
  arrWaypoint := MySplit(sList , " ");
 
  posX := arrWaypoint.Strings[0]; // 1000
  posY := arrWaypoint.Strings[1]; // 1450
  posZ := arrWaypoint.Strings[2]; // 7
end;
Responder Con Cita