Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Checking value of string

Checking value of string

Hello,

Small question:
How do you check value of a string?
eg.
class tmp
Real a=1;
String b="lol";
end tmp;
=>loadFile, simulate
val(a,0) =>1
val(b,0) =>NaN

gtz,
Dieter

Re: Checking value of string

You need to check it during runtime since the result format only supports doubles.

Re: Checking value of string

You can check it via if str1 == str2 then ... or via assert assert(str1 == str2)

Re: Checking value of string

you can print the string value by using Modelica.Utilities.Streams.print during the runtime.

Adeel.

Re: Checking value of string

great! Thank you all for quick responses.

gtz,
Dieter

There are 0 guests and 0 other users also viewing this topic
You are here: