Android Question XML String from webservice

folsd

Member
Hello,

I need to parse string that return from our web service.

when i invoke this service i get this string ;

<int xmlns="http://tempuri.org/">3</int>

How can i get "3" from this string in label text

thank you
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    123.6 KB · Views: 49

Brian Dean

Well-Known Member
Licensed User
Longtime User
You could either use string functions ...
B4X:
    Dim s As String = $"<int xmlns="http://tempuri.org/">3</int>"$   
    Dim p As Int = s.IndexOf(">")
    Dim q As Int = s.IndexOf2("<", p)
    Log(s.SubString2(p+1, q))

.. or you could use Regex. I am not very good at Regex. The expression "\>[0-9]+\<" will pick out all the numerals between > and <, including the < and > characters, but somebody else can probably do better than this.
 
Upvote 0
Top