خرید بک لینک

Vote count: -2

I have a int for example:

151515

1

1111111

4848484

111

888

I need to test/check if the number contains only 1s, valid examples:
1
11111
1111111111
11

Invalid examples:
88888888888
8885555
4747
7
889

Any suggestion?
Probably any regex? or there is a fast solution without regex and keep the value as an int without parsing it to String.

asked 1 min ago

1 Answer

Vote count: 0

Convert int to string first. Then try this regex:

"^[1]*$"

answered 13 secs ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 21 بهمن 1394 ساعت: 13:17

صفحه بندی