primo
14-02-2016, 11:24
i was about to ask a new feature like this
n = Tally(txt, Any "A" | "b" | "z")
does not work
then tried
n = Tally(txt, Any ("A" , "b" , "z"))
does not work
then searching the examples for the word "any", most of the results is "press any key to end"
then fortunately i saw "any $spc & $tab & $nul)" in example ODBC_EX_03, and i said thats it let me try again, and now it works :D
n = Tally(txt, Any "A" & "o" & "B" & "i" &"I" )
n = Tally(txt, Any "A" + "o" + "B" + "i" +"I" )
the two versions works
so my problem solved .
there is a famous basic programming language which have
CountString(txt, "a")
but seems not possible like in thinbasic, it does not accept multichoices inside CountString.
Uses "Console"
String txt
DWord n
txt = "Hello World from ThinBASIC!"
n = Tally(txt, Any "A" & "o" & "B" & "i" &"I" )
'n = Tally(txt, Any "A" + "o" + "B" + "i" +"I" )
'---Print the magic words
PrintL "Hello World from ThinBASIC!"
PrintL "number of characters AoBiI in the above phrase = " + Str$(n)
PrintL "Press a key to end program"
'---Wait for a key press
WaitKey
n = Tally(txt, Any "A" | "b" | "z")
does not work
then tried
n = Tally(txt, Any ("A" , "b" , "z"))
does not work
then searching the examples for the word "any", most of the results is "press any key to end"
then fortunately i saw "any $spc & $tab & $nul)" in example ODBC_EX_03, and i said thats it let me try again, and now it works :D
n = Tally(txt, Any "A" & "o" & "B" & "i" &"I" )
n = Tally(txt, Any "A" + "o" + "B" + "i" +"I" )
the two versions works
so my problem solved .
there is a famous basic programming language which have
CountString(txt, "a")
but seems not possible like in thinbasic, it does not accept multichoices inside CountString.
Uses "Console"
String txt
DWord n
txt = "Hello World from ThinBASIC!"
n = Tally(txt, Any "A" & "o" & "B" & "i" &"I" )
'n = Tally(txt, Any "A" + "o" + "B" + "i" +"I" )
'---Print the magic words
PrintL "Hello World from ThinBASIC!"
PrintL "number of characters AoBiI in the above phrase = " + Str$(n)
PrintL "Press a key to end program"
'---Wait for a key press
WaitKey