Pascalban hogy lehet lekezelni egy 500 ezer (vagy több) karakteres stringet? Egyáltalán le lehet?
AnsiReplaceStr, MidStr, stb. függvények használatához.
Ez az 1024-es limit nagyon kevés ahhoz, amit csinálni szeretnék. Annyi még max beelférne, hogy lebontani 1024-es blokkokra (még meg is tudnám oldani), de érdekelne hogy van-e rá lehetőség.
Egy focibajnokság éves adatait akarom feldolgozni. Az adat AJAX-en keresztül jön a szerverről HTML-be és azt kell feldolgozni, változókba rakni, stb.
Itt egy példa, ami valójában csak 1 sor a html-ben. A valóságban ez persze sokkal hosszabb:
{"data":[{"id":617319,"ht_score":null,"ft_score":"2-2","et_score":null,"home_team_id":520,"away_team_id":629,"home_score":2,"away_score":2,"home_score_penalties":0,"away_score_penalties":0,"formation":{"home":null,"away":null},"date_time_tba":0,"spectators":null,"starting_date":"2016-02-26","starting_time":"17:00:00","status":"FT","minute":90,"extra_minute":0,"competition_id":43,"venue_id":731,"season_id":350,"round_id":5561,"stage_id":821,"aggregate":null,"placeholder":false,"events":{"data":[{"id":489781,"match_id":617319,"team_id":520,"minute":80,"extra_min":null,"type":"yellowcard","player_id":56654,"player_name":"Ari Freyr Skulason"},{"id":489165,"match_id":617319,"team_id":520,"minute":89,"extra_min":null,"type":"yellowcard","player_id":8332,"player_name":"M. Greve"},{"id":489158,"match_id":617319,"team_id":629,"minute":86,"extra_min":null,"type":"yellowcard","player_id":54750,"player_name":"E. Bjarnason"},{"id":489155,"match_id":617319,"team_id":629,"minute":84,"extra_min":null,"type":"yellowcard","player_id":22394,"player_name":"J. J\u00f8nsson"},{"id":489134,"match_id":617319,"team_id":629,"minute":71,"extra_min":null,"type":"yellowcard","player_id":6343,"player_name":"D. Pedersen"},{"id":489119,"match_id":617319,"team_id":520,"minute":66,"extra_min":null,"type":"goal","player_id":8332,"player_name":"M. Greve","assist_id":61128,"assist_player_name":"A. Jacobsen"},{"id":489094,"match_id":617319,"team_id":520,"minute":53,"extra_min":null,"type":"goal","player_id":6582,"player_name":"A. Jacobsen","assist_id":null,"assist_player_name":null},{"id":489034,"match_id":617319,"team_id":629,"minute":32,"extra_min":null,"type":"yellowcard","player_id":44486,"player_name":"J. Elez"},{"id":489020,"match_id":617319,"team_id":629,"minute":16,"extra_min":null,"type":"goal","player_id":85603,"player_name":"N. Backman","assist_id":null,"assist_player_name":null},{"id":489016,"match_id":617319,"team_id":629,"minute":12,"extra_min":null,"type":"goal","player_id":54750,"player_name":"E. Bjarnason","assist_id":22395,"assist_player_name":"D. Olsen"}]}},{"id":77762,"ht_score":null,"ft_score":"1-1","et_score":null,"home_team_id":514,"away_team_id":519,"home_score":1,"away_score":1,"home_score_penalties":0,"away_score_penalties":0,"formation":{"home":null,"away":null},"date_time_tba":0,"spectators":null,"starting_date":"2016-02-27","starting_time":"15:00:00","status":"FT","minute":90,"extra_minute":0,"competition_id":43,"venue_id":4117,"season_id":350,"round_id":5561,"stage_id":821,"aggregate":null,"placeholder":false,"events":{"data":[{"id":494963,"match_id":77762,"team_id":519,"minute":90,"extra_min":null,"type":"goal","player_id":10719,"player_name":"J. Absalonsen","assist_id":null,"assist_player_name":null},{"id":494890,"match_id":77762,"team_id":514,"minute":88,"extra_min":null,"type":"goal","player_id":22293,"player_name":"M. Kalles\u00f8e","assist_id":null,"assist_player_name":null},{"id":494831,"match_id":77762,"team_id":519,"minute":84,"extra_min":null,"type":"yellowcard","player_id":7619,"player_name":"A. Guira"},{"id":494422,"match_id":77762,"team_id":519,"minute":61,"extra_min":null,"type":"yellowcard","player_id":12684,"player_name":"S. Kroon"},{"id":493464,"match_id":77762,"team_id":514,"minute":32,"extra_min":null,"type":"yellowcard","player_id":22287,"player_name":"M. Fenger"},{"id":493408,"match_id":77762,"team_id":514,"minute":27,"extra_min":null,"type":"yellowcard","player_id":22284,"player_name":"K. Johnsson"}]}},{"id":617024,"ht_score":null,"ft_score":"1-1","et_score":null,"home_team_id":628,"away_team_id":516,"home_score":1,"away_score":1,"home_score_penalties":0,"away_score_penalties":0,"formation":{"home":null,"away":null},"date_time_tba":0,"spectators":null,"starting_date":"2016-02-28","starting_time":"12:00:00","status":"FT","minute":90,"extra_minute":0,"competition_id":43,"venue_id":739,"season_id":350,"round_id":5561,"stage_id":821,"aggregate":null,"placeholder":false,"events":{"data":[{"id":499760,"match_id":617024,"team_id":628,"minute":45,"extra_min":null,"type":"yellowcard","player_id":34399,"player_name":"J. Thorsen"},{"id":499039,"match_id":617024,"team_id":628,"minute":90,"extra_min":null,"type":"penalty","player_id":33849,"player_name":"S. Andersen"},{"id":498958,"match_id":617024,"team_id":628,"minute":81,"extra_min":null,"type":"yellowred","player_id":34410,"player_name":"L. Lerager"},{"id":498830,"match_id":617024,"team_id":628,"minute":62,"extra_min":null,"type":"yellowcard","player_id":34410,"player_name":"L. Lerager"},{"id":498824,"match_id":617024,"team_id":516,"minute":60,"extra_min":null,"type":"yellowcard","player_id":8133,"player_name":"P. Gregor"},{"id":498471,"match_id":617024,"team_id":516,"minute":23,"extra_min":null,"type":"yellowcard","player_id":122885,"player_name":"Emre Mor"},{"id":498403,"match_id":617024,"team_id":516,"minute":10,"extra_min":null,"type":"goal","player_id":122885,"player_name":"Emre Mor","assist_id":null,"assist_player_name":null}]}},
7/7-es válasz segíthet. (Buffer terület átállítás.)
Kérdés még, hogy az Ajax válasz milyen módon fut be, mert annak a buffer területét is meg lehet akár célozni.
#6, igen ezen én is filóztam hogy ha már Ajax, akkor nincs hozzá egy parser vagy válasz objektum, bármi.
Csak nem vagyok otthon Ajax-php dolgokban. :)
Gyerekek a Pascalról, Pascalos megoldásról szól a kérdés.
Kérdező: Memo-ba simán be lehet olvasni, a Memo.Text-nél férsz hozzá, csak a megjelenítés miatt látsz benne sortörést. Az újabb Pascal, Delphi verziókban már sok lehetőség van a feldolgozásra, de simán lehet írni akármilyen eljárást, függvényt hozzá egyszerűen.
Tök mindegy, hogy Pascal, vagy pacal, vagy bármilyen másik nyelv a JSON attól még JSON, megvannak a kezelésére a magas szintű eszközök.
Stringként darabolgatni egész egyszerűen amatőr barbárság.
Kapcsolódó kérdések:
Minden jog fenntartva © 2024, www.gyakorikerdesek.hu
GYIK | Szabályzat | Jogi nyilatkozat | Adatvédelem | Cookie beállítások | WebMinute Kft. | Facebook | Kapcsolat: info(kukac)gyakorikerdesek.hu
Ha kifogással szeretne élni valamely tartalommal kapcsolatban, kérjük jelezze e-mailes elérhetőségünkön!