执行字符串包含逻辑语句 [英] executing string containg logical statement

查看:70
本文介绍了执行字符串包含逻辑语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含逻辑和条件语句的字符串,例如

I have a string that contains logical and conditional statement e.g

string str1 = @"if city=='ABC' && Amount <  1000 then image='abc.jpg' else if city=='xyz' || Amount < 5000 then image='qwe.jpg' else image ='default.jpg' ";



我要执行它,数量和城市都来自数组,还要插入适当的图像.



I want to execute it, amount and city are coming from an array and also insert the appropriate image.

推荐答案

看这里:

在C#或VB中进行动态逻辑表达式解析/评估? /a>
Look at this:

Dynamic logical expression parsing/evaluation in C# or VB?


这篇关于执行字符串包含逻辑语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆