小编Jan*_*ich的帖子

Send and receive data to and from a website using the TWebbrowser component in Delphi

I'm creating a VCL Application with Delpi 10.3 and want to support some web functionality by having the user enter the ISBN of a book into a TEdit component and from there passing/sending this value to a search field on this website: https://isbnsearch.org after which the website looks up the ISBN and displays the Author of the book. I want to somehow access the information (i.e Author) presented by the search result and again use it in my application.

This …

html delphi twebbrowser web

3
推荐指数
1
解决办法
145
查看次数

如何在 Delphi 中计算 JSON 数组中的元素数

我正在 Delphi 中访问 TJSONValue(使用 REST 组件和 Google Books 的 API)。我想知道数组中有多少元素:'items'。这是 JSONValue 的格式:

   "kind": "books#volumes",
   "totalItems": 221,
   "items": [
       {...},
       {...},
       {...}]
Run Code Online (Sandbox Code Playgroud)

注意*“totalItems”不是指数组的大小。

我已经沿着这条线尝试了一些东西,但它引发了一个转换错误。

var
   JSONBook: TJSONValue;
   CountItems: integer;
begin
   JSONBook := RESTResponse1.JSONValue;

   ShowMessage(IntToStr(JSONBook.GetValue<string>('items').Length));
   CountItems := JSONBook.GetValue<string>('items').Length;

   for i := 0 to CountItems-1 do
   begin
     ...
   end;
end;
Run Code Online (Sandbox Code Playgroud)

arrays delphi json count

2
推荐指数
1
解决办法
1691
查看次数

标签 统计

delphi ×2

arrays ×1

count ×1

html ×1

json ×1

twebbrowser ×1

web ×1