Issue while using stringfunctions

JDS

Active Member
Licensed User
Longtime User
When i'm using the following code gets the integer 'k' a negative value.
When i = 321 and j = 191 then k should become 130 but when i debug this (msgbox) then it seems to be -130.

The s-functions are from Margaret.

Does anyone have an idea?

B4X:
Sub Extract(sText As String, sFunctie As String) As String 
        Dim sFunctieStart As String
   Dim sFunctieEnd As String
   Dim sReturn As String
   Dim i,j,k As Int
   k = 0
   sReturn= ""
   sFunctie = s.Trim(sFunctie)
   sFunctie = sFunctie & "Result>"
   sFunctieStart    = "<m:"  & sFunctie
   sFunctieEnd    = "</m:" & sFunctie
   i = s.At(sText, sFunctieStart)
   j = s.Len(sText)
   k= i-j
 

mc73

Well-Known Member
Licensed User
Longtime User
You have
B4X:
[COLOR=#000000]i = s.At(sText, sFunctieStart)
    j = s.Len(sText)
    k= i-j

i is the place inside sText of the string sFunctieStart. j is the length of sText.
Why you think i should be bigger than j, since the length of a string is always greater or equal than a point inside it? Check your syntax.
[/COLOR]
 
Upvote 0
Top