Check If String Starts with Tab

How do I check if a string starts with a tab in Groovy?

1

1 Answer

This are some ways to do it....there are more like regex

​def s = "\t"​​

assert s[0] == "\t"
assert s.startsWith("\t")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest