If the var used is a number in stringformat you can simply convert it to an integer
if the var is 'anystring' then you first must check them with an IF statement
so IF var='anystring'then caseselctor :=1;
IF var = 'anystring1'then caseselctor :=2;
etc
next question is
case temp of
0:test:=STRING_TO_BOOL (trig) ;(it will return bool)
(test must be declared as bool obvious)
1:tester:=STRING_TO_INT (trigg); (it will return int)
2:testerhw:=STRING_TO_REAL(trigrrw);(it will return float)
end_case
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This means your string must be an integer like '123'
it can not be 'onehundredtwentythree'
in that case you will have to use my solution with the IF statements.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi
how to put up a case statement in a function for this case
case temp of
0:test:=trig(it will return bool)
1:tester:=trigg(it will return int)
2:testerhw:=trigrrw(it will return float)
end_case
and one more thing can we use case for a string as need for string operations
Thanks
Hi,
just convert STRING_TO_INT and u can use in Case statement too.
But still am wondering how to implement in function for the above requirement.
No case can only be used with a INT as selector.
If the var used is a number in stringformat you can simply convert it to an integer
if the var is 'anystring' then you first must check them with an IF statement
so IF var='anystring'then caseselctor :=1;
IF var = 'anystring1'then caseselctor :=2;
etc
next question is
case temp of
0:test:=STRING_TO_BOOL (trig) ;(it will return bool)
(test must be declared as bool obvious)
1:tester:=STRING_TO_INT (trigg); (it will return int)
2:testerhw:=STRING_TO_REAL(trigrrw);(it will return float)
end_case
Hi
Steps you said can be a proper way to do
I used STRING_TO_INTEGER it is working fine
Any thing is wrong with this
Regards,
Sarath
This means your string must be an integer like '123'
it can not be 'onehundredtwentythree'
in that case you will have to use my solution with the IF statements.