String a= "hello.a.java;b.java;hello.java;hello.toha;";
//将每个分号的内容取出来
String[] res=a.split(";");
//输出此数组
System.out.println(Arrays.toString(res));
for (String string : res) {
//输出每个数
System.out.println(string);
//输出前缀为hello的
if(string.startsWith("hello")) {
//计算最后一个点的位置
int index = string.lastIndexOf(".");
System.out.println(index);
//分离最后一个点前后的内容
String newname=string.substring(index);
System.out.println(newname);
System.out.println("************");
}
}

[hello.a.java, b.java, hello.java, hello.toha]

hello.a.java
7
.java
************

b.java

hello.java
5
.java
************

hello.toha
5
.toha
************

java39的更多相关文章

随机推荐

  1. 使用samba 共享Linux文件到Windows

    1.使用yum命令安装了samba服务 #yum install samba 2.配置/etc/samba/smb.conf文件,在最后一行添加下面一段配置: #vi /etc/samba/smb.c ...

  2. Zabbix常见问题

    1.Q:  agent日志中出现“active check configuration update from [127.0.0.1:10051] started to fail (cannot co ...

  3. Unresolved externa Round

    [ilink32 Error] Error: Unresolved external '__stdcall Round(const double, int)' referenced from e:\工 ...

  4. The type initializer for System.Data.SqlClient.SqlConnection threw an exception

    The type initializer for System.Data.SqlClient.SqlConnection threw an exception net framwork啥原因 xp电脑

  5. MySQL中链接查询inner join与left join使用

    连接查询其实就是对两个表记录做笛卡尔乘积.如果不指定连接条件的话,则会对每行都做笛卡尔乘积,这样最后返回的结果树就会是两个表记录数的乘积:如果指定则,则仅对符合列条件的行进行笛卡尔乘积,并返回结果.在 ...

  6. nginx 的安装、启动、停止与重启

    一.nginx 基本介绍 1.Nginx 是单进程单线程模型,也就是启动的工作进程只有一个线程响应客户端请求,而 apache 可以在一个进程内启动多个线程响应客户端请求.所以 nginx 的内存占用 ...

  7. layui时间控件,获取页面选中的时间值。

    先贴上html文档 <div class='layui-form'> <div class="layui-form-item"> <div class ...

  8. c# System.Console

    System.Console类公开了和操作控制台相关的有用的静态字段和静态方法.下面是System.Console中一些较为重要的方法. public static void Beep()该方法播放蜂 ...

  9. 【转】如何使用离线博客发布工具发布CSDN的博客文章

    目前大部分的博客作者在用Word写博客这件事情上都会遇到以下3个痛点: 1.所有博客平台关闭了文档发布接口,用户无法使用Word,Windows Live Writer等工具来发布博客.使用Word写 ...

  10. Unity shader 官网文档全方位学习(二)

    摘要: 这篇文章主要介绍Lighting model及自定义Lighting model 上文咱们学了surface shader.这玩意在开始的时候啊,在定义哪个函数处理surface时用一定要指定 ...