Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

save parts of text in new var or array
Started by jcarlosnunezperez May 24 2019 12:19 AM

- - - - -
1 reply to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

jcarlosnunezperez

[GLOBAL: userInfoPane.html]
jcarlosnunezperez
  • Observer

  • 16 posts
  • Corona SDK

Hi, 

 

i'm new in corona SDK, and I have one problem.

 

When I do one network listener, I have one var with this text: (example)

 

"<p>XXX XXXX XXX</p><p>XXX XXXX XXX</p><p>XXX XXXX XXX</p><p>XXX XXXX XXX</p><p>XXX XXXX XXX</p><p>XXX XXXX XXX</p><p>XXX XXXX XXX</p><p>XXX XXXX XXX</p><p>XXX XXXX XXX</p><p>XXX XXXX XXX</p>"

 

Can I cut and save in others var, or maybe in a array, like this:

 

var[1] = XXX XXXX XXX

var[2] = XXX XXXX XXX

var[3] = XXX XXXX XXX

var[4] = XXX XXXX XXX

...

 

 

Thx!!



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,201 posts
  • Enterprise

That looks like you're getting HTML back from the server. HTML is XML and you can use an XML parser.  There is an xml.lua file in our Business App Sample that you probably could use for this:

 

https://github.com/coronalabs-samples/business-app-sample

 

You pass it the response and it should return you a table of strings that you can loop over and copy to your table.

 

Rob




[topic_controls]
[/topic_controls]