BUG-1275: speedup toPredicateValue()

Instead of performing startsWith/endsWith, we first check the first
character and based on that we optinally trim the string to the matching
character. Also fixes a bug, where string like 'abc" would be accepted.

Change-Id: I683074ec53a7924812d9fe77b669e7cab5f32ea8
Signed-off-by: Robert Varga <rovarga@cisco.com>