I am working in school project. In that what they told is, I will be given a String which contains an actual program like….
import java.io.*\npublic class A{\n………..EOF
And My job is to find particular regular expressions in that String(Program).
Now My question is..
void myFunc(String s)
{
while(s.charAt(i) != EOF) /*needed replacement for EOF*/
{
// Actual Code
}
}
In the above code, how to find whether EOF is reached in a string?
There is no EOF character in a string. You just need to iterate over the characters in the string: