문제

I'm currently stringtokenizing the following line.

2014-03-24 19:11:42.838  7611.668 UDP       192.168.0.15:5353  ->      224.0.0.251:5353        53     5353    12

I actually want the "2014-03-24 19:11:42.838" as a token itself but I cant seem to figure out how to get the stringtokenizer to skip the space in between.

도움이 되었습니까?

해결책

  1. You can read two tokens and then concatenate them

  2. it seems that there is two spaces after token you want. If it's true you can use indexOf to get index of two spaces and then use substring.

  3. You can use Scanner.next(pattern) to get this string. all you need is correct pattern

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top