本文介绍了split()和String []的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,


好​​的,所以使用以下代码:


//假设这已经充满了输入

String MyInput;

String [] MySplits;


MySplits = MyInput.split(" ;;");


我怎样才能确定返回多少字符串

MySplits而不从0到1,000,000迭代并等待

抛出异常?


谢谢,

迈克

Hey,

Okay, so with the following code:

// assume this is full of input already
String MyInput;
String [] MySplits;

MySplits = MyInput.split(";");

How can I determine how many strings were returned into
MySplits without iterating from 0 to 1,000,000 and waiting
for an exception to be thrown?

Thanks,
Mike

推荐答案




MySplits.length



MySplits.length




MySplits.length



MySplits.length






嗯嗯,这不是一个有效的借口作为一个字符串也有这个

。是的,所以我不知道为什么我错过了!双倍

ouch。


Mike



Uhhhh, nope that''s not a valid excuse as a String has that
too. Right, so I have no idea why I missed that!!! Double
ouch.

Mike


这篇关于split()和String []的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-09 13:16