Блог пользователя zulkan

Автор zulkan, 13 лет назад, По-английски

I have this code http://ideone.com/aAhXE8

but in cf (custom test) it has different output http://s16.postimg.org/hug6l6y4l/bug.jpg

why is the newline character still entering the loop ?

in my computer the output is like the one in ideone, is it a bug in CF ?

edit : answered, CF is using : ~~~~~ "\r\n" ~~~~~

  • Проголосовать: нравится
  • -2
  • Проголосовать: не нравится

»
13 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

I think, it's better to write like this while ((c = (char)br.read()) && c >= '0' && c <= '9') (Sorry for my poor english)

»
13 лет назад, скрыть # |
 
Проголосовать: нравится +26 Проголосовать: не нравится

You can fix it if you add && c != '\r' into if condition. It happend because of difference between newline representation by Linux and Windows. http://en.wikipedia.org/wiki/Newline#Representations