---
title: "java基础"
author: "savefrom"
date: "2008-12-29T10:57:30Z"
tags: []
categories: ["企业架构"]
slug: "java"
draft: false
lastmod: "2008-12-29T10:57:30Z"
id: 306198
url: "https://savefrom.iteye.com/blog/306198"
---

```java

String strl = "12ssweeks324failed";
        int endindex1 = strl.indexOf("weeks");
        System.out.println(strl.substring(0, endindex1));
        if (endindex1 != -1) {
            System.out.println("==1");
        } else {
            System.out.println("==2");
        }
        int startindex = endindex1 + 5;
        endindex1 = strl.indexOf("failed");
        System.out.println(strl.substring(startindex, endindex1));

```