Java Programming

Site Stats
APCS schedule | APCS LogIn | APCS Forms | APCS Resources | APCS Archive | APCS Stuff
Java schedule | Java LogIn | Java Forms | Java Resources | Java Archive | Java Stuff
Adven schedule | Adven LogIn | Adven Forms | Adven Resources | Adven Archive | Adven Stuff
Stats schedule | Stats LogIn | Stats Forms | Stats Resources | Stats Archive | Stats Stuff

Java substrings part 3 - directories and files

  Updated : January 11, 2010 9:24 AM

Count and ONLY output the file or directory names.

Input file : publicA.txt

Sample output

 

 

indexOf

public int indexOf ( String  str)

Returns the index within this string of the first occurrence of the specified substring. The integer returned is the smallest value k such that: this.startsWith(str, k ) is true .

Parameters: str - any string.

Returns: if the string argument occurs as a substring within this object, then the index of the first character of the first such substring is returned; if it does not occur as a substring, -1 is returned.

 

substring

Public String substring (int beginIndex) Returns a new string that is a substring of this string. The substring begins with the character at the specified index and extends to the end of this string.

Examples: "unhappy".substring(2) returns "happy"
"Harbison".substring(3) returns "bison"
"emptiness".substring(9) returns "" (an empty string)

Parameters: beginIndex - the beginning index, inclusive.

Returns: the specified substring.

Throws: IndexOutOfBoundsException - if beginIndex is negative or larger than the length of this String object.

 

 

 

 

  

H K N O P Sh Sm W
L Not Listed


Last Name :

Email :

Select one of the following that describes when and why you are filling out this form:
This assignment is in on time.
This assignment is in on time, being resubmitted due to a failed submission (I have a copy of the original submission).
This assignment is a corrected submission for half the missed credit.
This assignment is one day late and will lose 15%.
This assignment is more than one day late (half credit at best).
This assignment is late because of an EXCUSED absence.
This assignment is being resubmitted at the request of the teacher.


main method code

How many lines did you output?

Updated: Monday, January 11, 2010 9:24 AM

 

 

 

About | Site Map | Contact | Search | ©2005 brentwoodhigh.com