现在的位置: 首页 > 综合 > 正文

[代码]大家来动动脑筋吧

2012年11月11日 ⁄ 综合 ⁄ 共 464字 ⁄ 字号 评论关闭
要求:不使用正则表达式等,只依赖基本的字符串操作,在一个字符串数组中检查电话号码和URL。
 Vector  text (its elements are String) 

eg:  "Hello, nice to meet you. Welcome to"               text.elementAt(0)
      "contact with us , our telephone is +86"              text.elementAt(1)
      "1084848888 and homepage is http://"               text.elementAt(2)
      "www.abc.com.cn. do you got it ?"                      text.elementAt(3)

程序需要正确的识别出+861084848888 这个电话号码和 www.abc.com.cn 这个URL.并且要能够记录它们在字符串中的位置,并计算在哪一行。

看上去不是很困难。但是写的好也不容易。

感兴趣的朋友动动脑筋吧。

抱歉!评论已关闭.