java字符分割_java – 将字符串拆分为两半

我正在制作一个新的转换软件来隐藏消息(为了好玩).我做了一个二进制和十进制转换类,我的想法是,用户输入字符串,它将所有转换为二进制格式.然后将它分成两半,将一半转换为十进制,然后再将字符串重新添加到一起,使其成为二进制和十进制的混合.在其他版本中,我将添加更多转换,更多分割,也可能转换为语言.我需要将字符串分成两半.到目前为止这是我的代码::

public ray() {

Scanner in = new Scanner(System.in);

while (true) {

System.out.println("Please input the text you wish to encode!");

System.out.println("Type '#' to quit the Software.");

String s1 = in.nextLine();

if ("#".equalsIgnoreCase(s1)) {

System.out.println("Goodbye, hope you enjoyed RAYConversion v1.0 Alpha.");

// close software

}

// convert all to binary

binary Binary = new binary();

//what i need to do is split stirng s1 in half, make it into different strings. Then I will convert

//the two strings to binary and decimal. I made a converter for that.

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值