Reputation: 2665
I have a column in a table and some values has back slash / towards end. i want to remove these slash value and retain the rest of text. so lets say i have a text "myjunkdata/"
, it should give me back "myjunkdata"
. However below condition is not working.
(StringHandling.RIGHT(row1.CertificateName,1) == "/") ? StringHandling.LEFT(row1.CertificateName,StringHandling.LEN(row1.CertificateName)-1) : row1.CertificateName
example data below
Certified SOA Security Specialist/
Information Security Management Principles Foundation Certificate/
Check Point Certified Security Administrator R77/
Check Point Certified Security Expert R77/
Check Point Managed Security Expert/
Cisco Certified Network Associate Security
Cisco Certified Network Professional Security
Cisco Certified Internetwork Expert Security
Cisco Certified Network Professional Security
Can anyone help?
Upvotes: 0
Views: 990
Reputation: 14572
Dont compare String
with ==
StringHandling.RIGHT(row1.CertificateName,1).equals("/")
But you could do the same condition with :
row1.CertificateName.endsWith("/")
But of course, a regex is always a solution to do this simply
row1.CertificateName.replaceAll("/$")
The regex /$
basicly means ending with /
so it will remove that character if it exist.
Upvotes: 3