ios


Process user-inputted conditions (==, &&) inside app


I have the task, and I can understand how to deal with it (in what direction I need to start). Application need to understand user-inputted condition like that:
((VAR1 != 1 && VAR2 == 2) OR (VAR3 != 1 && VAR4 == 2)) AND (VAR5 = 2)
I have that variables inside my database, so it's no problem to replace VAR1 with real data. How in what way I can process that condition inside application. I thought about separating full condition to little blocks, but I don't understand yet how to separate, there is no symbol that I can split string.
So can you help in what direction I need to start working to process such conditions in Swift app?
Thanks to #Sulthan, NSPredicate is solution.
let expressionString = "((1 == 1) or (1 == 2)) and (1 == 2)"
let predicate = NSPredicate(format: expressionString)
print(predicate.evaluateWithObject(nil))
// Output: false

Related Links

Deprecated push segues and unwanted modal behavior
Message sent to deallocated instance in swift
How can I read a json file in the Documents Directory in swift?
NSFastEnumerationIterator.Element (aka Any) has no subscript members
What is the difference between the modal presentation style “over current context” and “over fullscreen”?
(iOS) Increasing memory consumption related to GameScene
UICollectionView crashes when scrolling to the bottom
Flexbox on IOS scrolls differently
Firing an embeded AVPlayerViewController programatically from a TableView
Dissmiss alertview created by LMAlertView on outside tap
Cordova build failed for ios after installing pushwoosh notifications plugin
Facebook not redirecting to application from safari view
Custom rounded UIView in Swift?
Swift concatenate string based on different values
Xcode 8 GM App running on simulator but not on device pods issue
WKWebView loadFileURL works only once

Categories

HOME
ios
web-applications
whatsapp
ssl-certificate
weight
svg.js
antlr
logback
oracle-adf
c++14
ibm-midrange
phpmailer
asp.net-mvc-3
autofac
asciidoc
sonata-admin
editor
embed
flow
gitlab-ci-runner
smartcard
flexjs
buffer-overflow
bluebird
matterjs
increment
transpose
runge-kutta
tibco-ems
jsonstore
php-5.5
mergesort
qmenubar
pulseaudio
autofocus
smartbanner
jquery-masonry
database-cleaner
dump
reactivex
paypal-webhooks
javascript-security
catalina
android-camera-intent
jeditorpane
tachyon
angular2-rc5
cakephp-2.3
error-correction
nsd
ultratree
olingo
turnjs
printscreen
data-fitting
qlpreviewcontroller
bash-completion
accounts
wgs84
kinto
monkeyrunner
movie
iife
swift-array
imake
nolio
boxapiv2
lwuit-list
syndication-feed
notifydatasetchanged
aps
image-scaling
antisamy
preon
ramdisk
jquery-mobile-popup
gora
webcal
xcode4.2
jflow
mosek
arbtt
virtual-earth
hogan.js
nspersistentdocument
shebang
timestamp-with-timezone
ariatemplates
maven-bundle-plugin
noindex
objcopy
b-method
bapi
payment-services
facebook-authentication
nntp
jquery-pagination
measure
nscollectionviewitem
android-searchmanager
xoom
network-scan
sqlitemanager
newsgroup

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App