Jump to content

String tokenizer

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
gandudu

gandudu

    Newbie

  • Members
  • PipPip
  • 14 posts
I want to ask that how I can split the string text from an textarea into 64-bit each parts in char?

Eg:
'I here try to ask how to do the string tokenizer'

'I here t' || 'ry to as' || ...

#2
farrell2k

farrell2k

    Learning Programmer

  • Members
  • PipPipPip
  • 60 posts
If I understand you correctly:

String input = textArea.getText();

String input1 = input.subString(0,63);

String input2 = input.subString(64, 127);

That should split a 128 character string into 2, 64 character strings. From there, it is even possible to send them to a char[] with .toCharArray(), if you want.

Is this what you want to do?

#3
abzero

abzero

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 217 posts
Another method would be to use StringInputStream and read out 8 chars at a time. Are you implementing some sort of cipher?