Line | |
---|
1 | package ise.antelope.tasks.typedefs.string;
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Copyright 2003
|
---|
5 | *
|
---|
6 | * @version $Revision: 1.1 $
|
---|
7 | */
|
---|
8 | public class IndexOf implements StringOp {
|
---|
9 |
|
---|
10 | private String string = "";
|
---|
11 | private int fromIndex = 0;
|
---|
12 |
|
---|
13 | public void setString(String s) {
|
---|
14 | string = s;
|
---|
15 | }
|
---|
16 |
|
---|
17 | public void setFromindex(int i) {
|
---|
18 | fromIndex = i;
|
---|
19 | }
|
---|
20 | /**
|
---|
21 | * Description of the Method
|
---|
22 | *
|
---|
23 | * @param s
|
---|
24 | * @return the index of the substring in the given string as a String, or '
|
---|
25 | * "-1" if not found.
|
---|
26 | */
|
---|
27 | public String execute(String s) {
|
---|
28 | if (s == null)
|
---|
29 | throw new IllegalArgumentException("string cannot be null");
|
---|
30 | return String.valueOf(s.indexOf(string, fromIndex));
|
---|
31 |
|
---|
32 | }
|
---|
33 | }
|
---|
34 |
|
---|
35 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.