Link to home
Start Free TrialLog in
Avatar of boukaka
boukakaFlag for Canada

asked on

Find a character and return last 2 characters in a string

Hi there,

I have a string which will have a comma in it. I want to say, if MyString has a comma in it then return the last two characters of the string otherwise return the first two characters. How do I do that?

My string is being read from a text file like this

MyString= line.Substring(268,20).Trim()
Avatar of adathelad
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of boukaka


PERFECT!! Thank you so much. I found the bug last minute and this has to be fixed asap.