AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Object-Pascal / Delphi-Language Delphi String in Array zerlegen (Markanter Punkt: ',')
Thema durchsuchen
Ansicht
Themen-Optionen

String in Array zerlegen (Markanter Punkt: ',')

Ein Thema von rebugger · begonnen am 31. Okt 2002 · letzter Beitrag vom 2. Nov 2002
 
rebugger

Registriert seit: 29. Okt 2002
Ort: Auerbach
190 Beiträge
 
Delphi 7 Professional
 
#9
  Alt 1. Nov 2002, 13:33
OK, Alles nochmal:
Code:
type TZeile = array of string;
.
  public
    { Public-Deklarationen }
    function Intialize_Highlight(): Bool;
    function Parse(zeile: string;zeilennummer:longint ):TZeile;
.
function TMain.Parse(zeile: string;zeilennummer:longint ):TZeile;
var i    :longint;
    anzahl:longint;
    pos  :array of integer;
begin
  anzahl:=0;
  SetLength(pos,0);
  SetLength(result, 0);
  for i := 1 to Length(zeile) do
    if zeile[ i ] = ';' then // <-- ACHTUNG KORRIGIERT!!!
    begin
      inc(anzahl);
      SetLength(pos, anzahl);
      pos[anzahl-1]:=i;
      SetLength(result, anzahl);
    end;
  for i:=0 to high(result) do
    begin
      if i=0 then
        result[i ]:=copy(zeile,1,pos[0]-1)
      else
        result[i ]:=copy(zeile,pos[i-1]+1,pos-1-pos[i-1]); // <-- ACHTUNG KORRIGIERT!!!
    end;
  //if Length(result)=0 then Messagebox(0, '', 'Fehler', 0);
end;

function TMain.Intialize_Highlight(): Bool;
var
  ini: TIniFile;
  php_comment, php_identifier, php_invalidsymbol, php_key,
  php_number, php_space, php_string, php_symbol, php_variable: TZeile;
  tmp_style: TZeile;
begin
  ini := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'highlight.cfg');
  try
    php_comment := Parse(ini.ReadString('PHP','Comment','$0045CDFA,clNone,0,1,0,0'), 0);
    PHPhigh.CommentAttri.Foreground := IntToStr(php_comment[0]);
    PHPhigh.CommentAttri.Background := IntToStr(php_comment[1]);

    if IntToStr(php_comment[2]) = 1 then
      PHPhigh.CommentAttri.Style := fsBold;
    if IntToStr(php_comment[3]) = 1 then
      PHPhigh.CommentAttri.Style := fsItalic;
    if IntToStr(php_comment[4]) = 1 then
      PHPhigh.CommentAttri.Style := fsUnderline;
    if IntToStr(php_comment[5]) = 1 then
      PHPhigh.CommentAttri.Style := fsStrikeOut;

  finally
    ini.Free;
  end;
end;
Er sagt mir:
[Fehler] main_unit.pas(157): Operator ist auf diesen Operandentyp nicht anwendbar
Die Zeile:
Code:
result[i ]:=copy(zeile,pos[i-1]+1,pos-1-pos[i-1]);
Wo liegt der Fehler ?
Kann ich das ganze nicht verkürzen ?
Ich müsste das ganze sonst noch mit PHPhigh.IdentifierAttri.... und noch weiteren 40 Objekten machen und das wäre sehr viel Code !
Kann man das alles nicht in eine Funktion zusammenfassen, an die ich nur noch z.B. "PHPHigh.CommentAttri" übergeben muss ?
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:48 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz