iOS Question LastindexOf2 Problem

hatzisn

Well-Known Member
Licensed User
Longtime User
Hi everyone,

Consider the following line of code:

B4X:
iU2 = TextToSpeak.LastIndexOf2(sDelimiter, iEnd)

Where sDelimiter="." and iEnd=1000.

Is it possible ever to return a value greater than 1000 if there is an sDelimiter in a position lesser than 1000. Even if there is not is it possible to return such a value (>1000) ?

Well it does

Any suggestions?
 

ThRuST

Well-Known Member
Licensed User
Longtime User
Hi @hatzisn I believe you should better provide more details about what library/modules you are using to increase chances to get an accourate response, except this :)
You might want to send the author of the library a personal message or keep search the forum, even google might do the trick.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
[B4J - I don't have B4i]

B4X:
    Dim TextToSpeak As String
    Dim sDelimiter As String = "."
    Dim iEnd As Int = 1000
    Dim iu2 As Int
    
    For i = 1 To 110 ' TextToSpeak will be 1,100 long
        TextToSpeak = TextToSpeak & "asd.dsa.12"
    Next
    iu2 = TextToSpeak.LastIndexOf2(sDelimiter, iEnd)
    Log(iu2) ' 997 - correct
 
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
@LucaMs the code comes from the module TTSFunctions I have posted in B4A forum. In B4A the same code works perfect

@Erel Here is a test Project in B4i... Find it attached...
 

Attachments

  • CheckLastIndexOf2.zip
    3 KB · Views: 149
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
Thanks, Erel.
 
Upvote 0
Top