سؤال

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