Jump to content
  • 0

Stringtokenizer Space?


Ο Χάρος

Question

Hello, i made a code and basically capture tokens from bypass using StringTokenizer tk = new StringTokenizer(command, " ");

and the bypass is like

%objectId%_something $var1 $var2 $var3 

 

the problem is that i use 3 boxes to fill (3 variables) and if a player inside box he use space to write 2 words it capture the 2nd word as another token so it end up like

4 token instead of 3.

 

How can i avoid this? Like if a player writes in box "Something Something" this will be captured as 1 token instead of 2 tokens ?

 

Thanks a lot.

Link to comment
Share on other sites

Recommended Posts

  • 0

Did you try it? It's not working + eclipse can't compile this character.

use type casting

(char)161
Edited by melron
Link to comment
Share on other sites

  • 0

Can you give an example or tell us how this one will help this problem?

 

This guy didnt want to cancel the proccess when one more token found , contrary he want the unexpected tokens as one string with spaces inside.

i believe trim is useless, correct me if im wrong

Yes, this will fix the problem.

Example:

TextBox 1: asd

TextBox 2: sss ddd

TextBox 3: ddd 2 uuu

 

Bypass will look like this: "npc_%objectId%_test asd ¡ sss ddd ¡ ddd 2 uuu".

.trim() is needed so spaces at the beginning and at the end of the token will be removed, for example "asd " will be turned into "asd", " sss ddd " into "sss ddd".

Link to comment
Share on other sites

  • 0

The bypass command line have limited length. Use RequestBBSwrite packet. He don't have problems with spaces, etc.

And how ill use the bbswrite? Cause i changed bypass to bypass -h still when i write bigger than 15 char in box it no accept it.

Link to comment
Share on other sites

  • 0

And how ill use the bbswrite? Cause i changed bypass to bypass -h still when i write bigger than 15 char in box it no accept it.

 

You need to learn the Community Board style for inputs form. They uses another link style for buttons.

Link to comment
Share on other sites

  • 0

You need to learn the Community Board style for inputs form. They uses another link style for buttons.

yea that what im asking lel,, the style in request bypass is example bypass -h blabla

 

in community is ?

Link to comment
Share on other sites

  • 0

yea that what im asking lel,, the style in request bypass is example bypass -h blabla

 

in community is ?

 

Open commynity Mail section and you find the answer. Don't be lazy.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...