Alex Rivera | Logout

In Java, remove the first char of the string if it is , (comma)

Asked 2012-08-15T09:35:10.367
15

In Java, I have a String variable.

Sometimes the first character of the string is a comma ,

I want to remove the first char only if it is a comma.

What is the best approach to do this?

Edit
Report

1 Answer

2

If you have commons-lang in your classpath, may have a look at StringUtils.removeStart(String str, String remove)

answered 2012-08-15T11:10:19.173

Your Answer