Android Question Warning : ',' expected, and object converted to string. This is probably a programming mistake???

adaw

Member
Hi guys,,
I have a code program, but when I compile it, I get errors warning :
',' expected.
Object converted to String. This is probably a programming mistake.(warning #7)

my code program is :
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region

Sub Process_Globals
Type Pattern (Loc As Int, c As Char)
Dim T, P As String
Dim QsBc(127) As String
Dim Fq(127) As String
Dim Pat(127) As String
Dim fx As Int

End Sub

Sub AppStart (Args() As String)
T = "GCATCGCAGAGAGTATACAGTACG"
P = "GCAGAGAG"
preQsBc(T,P)
Freq(T,P)
OrderPattern(T,P)
optimalPcmp(T,P)
End Sub

Sub preQsBc(Te As String, Pt As String) 'fix codenya
Log("Nilai QsBc")
For i = 0 To Te.Length-1
QsBc(Asc(Te.CharAt(i))) = Pt.Length+1
Next
For i = 0 To Pt.Length-1
QsBc(Asc(Pt.CharAt(i))) = Pt.Length-i
Next
For i = 0 To Pt.Length-1
Log(Pt.CharAt(i) & " = " & QsBc(Asc(Pt.CharAt(i))))
Next
End Sub

Sub Freq(Tk As String, Pn As String) 'fix codenya
Log("Nilai frekuensi")
For i = 0 To Tk.Length-1
Fq(Asc(Tk.CharAt(i))) = 0
Next
For i = 0 To Tk.Length-1
Fq(Asc(Tk.CharAt(i))) = Fq(Asc(Tk.CharAt(i))) + 1
Next
For i = 0 To Pn.Length-1
Log(Pn.CharAt(i) & " = " & Fq(Asc(Pn.CharAt(i))))
Next
End Sub

Sub OrderPattern (Xt As String, Np As String)
Dim ptrn As Pattern
ptrn.Initialize
For i = 0 To Np.Length-1
ptrn.loc = i
ptrn.c = Pat(Asc(Np.CharAt(i)))
Pat(Asc(Np.CharAt(i))) = ptrn
Next
For i = 0 To Np.Length-1
Log(Pat(Asc(Np.CharAt(i))))
Next

End Sub

Sub optimalPcmp(m As String, n As String)
Dim pat1, pat2 As Pattern
pat1.Initialize
pat2.Initialize
fx = Freq(pat1.c) - Freq(pat2.c)

End Sub


Please help me, guys to solve this problem..
Thanks
 

ilan

Expert
Licensed User
Longtime User
Object converted to String

this happens in this line:

B4X:
Pat(Asc(Np.CharAt(i))) = ptrn

you cannot convert a type object to an int. you probably wanted to write

B4X:
Pat(Asc(Np.CharAt(i))) = ptrn.Loc

Object converted to String. This is probably a programming mistake.(warning #7)

this warning happens in this line:

B4X:
fx = Freq(pat1.c) - Freq(pat2.c)

the warning is because your sub

B4X:
Sub Freq(Tk As String, Pn As String)

is expecting 2 arguments (2 strings) but you gave only 1
 
Upvote 0

adaw

Member
1. You should post questions in the questions forum.
2. Please use [code]code here...[/code] tags when posting code.
3. Make sure to write which line caused this warning.

I'm sorry... I didn't know about it.. Thanks for your information... I hope you can help my problem :)
 
Upvote 0

adaw

Member
this happens in this line:

B4X:
Pat(Asc(Np.CharAt(i))) = ptrn

you cannot convert a type object to an int. you probably wanted to write

B4X:
Pat(Asc(Np.CharAt(i))) = ptrn.Loc



this warning happens in this line:

B4X:
fx = Freq(pat1.c) - Freq(pat2.c)

the warning is because your sub

B4X:
Sub Freq(Tk As String, Pn As String)

is expecting 2 arguments (2 strings) but you gave only 1

Thanks for your information..
What should i do to solve my problem??
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Thanks for your information..
What should i do to solve my problem??

fix your code.

i dont know what you are doing in your code but you should know it.
if you ask for 2 arguments in your sub then you probably need 2 arguments.

B4X:
Sub Freq(Tk As String, Pn As String)

if you create a type that is build from a char and an int then you probably want to use the int of it in this line dont you???

B4X:
Pat(Asc(Np.CharAt(i))) = ptrn.Loc

i dont know what your code is used for so i cannot tell you how to use it.
what are you trying to do in your code?
 
Upvote 0
Top