B4J Question [BANanoVuetifyAD3] string indexOf not supported ?

Hi,

I'm trying to use string.indexof() in BANano but it is that not supported ?

I get this error in the consol
TypeError: __1462.indexOf is not a function


B4X:
Dim calculated_str As String = "125.45"
Dim check_index_of_dot As Int
check_index_of_dot = calculated_str.IndexOf(".")
 
Solution
Sorry my rookie mistake I guess.
I forgot to use NumberFormat when converting Double to String.
I just set the String = Double and that will not give a compile error but I think the String changes object from String to Double and then the .indexOf function is not available for the Double.
One thing that is a bit strange is that when I use NumberFormat in BANano then I get a "," (comma) and not "." (dot) as when I run the ordinary B4J.

Thanks for the help!
Ok but if I remove the row with the .IndexOf then it works then the function continuous otherwise it just seems to stop and returns to where it was called from.
And it compiles and the code is transpiled if I look at the generated code.
Transpiled code:
__1463=__1462.indexOf(".");

And the consol error in full:
vue.min.js:6 TypeError: __1462.indexOf is not a function
at banano_gaskettool_gasketmain.numberformat2_own (app1634711912686.js:3)
at banano_gaskettool_gasketmain.updategasketprice (app1634711912686.js:3)
at banano_gaskettool_gasketmain.gsksize_action (app1634711912686.js:3)
at banano_gaskettool_gasketmain.gska1size_change (app1634711912686.js:3)
at a._cb (bananovuetifyad3.js:17)
at He (vue.min.js:6)
at a.n (vue.min.js:6)
at He (vue.min.js:6)
at a.e.$emit (vue.min.js:6)
at a.updateValue (vuetify.min.js:6)


But if you say it should work then I will continue to debug to see if I can find out what is wrong.
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
I meant check these logs in the IDE first before you run and during compilation:

1634735231391.png


Is there anything on your side that is being reported, eg. undeclared type, usually if you have error 10 and 11, your app wont work as expected. The log at the bottom will usually have an error and indicate the line where the error happens. Check the top log before you run if there is anything reported out of the ordinary, the bottom one will be useful to find errors during compilation. If you are unclear, copy both to files, zip them and attach here and I can check for you.
 
Upvote 0
Sorry my rookie mistake I guess.
I forgot to use NumberFormat when converting Double to String.
I just set the String = Double and that will not give a compile error but I think the String changes object from String to Double and then the .indexOf function is not available for the Double.
One thing that is a bit strange is that when I use NumberFormat in BANano then I get a "," (comma) and not "." (dot) as when I run the ordinary B4J.

Thanks for the help!
 
Upvote 0
Solution
Top