#Java 10, 94 bytes
Java 10, 94 bytes
p->s->{for(var w:s.split(" "))if(w.startsWith(p))System.out.println(w.substring(p.length()));}
Try it online here.
Ungolfed:
p -> s -> { // lambda taking prefix and text as Strings in currying syntax
for(var w:s.split(" ")) // split the String into words (delimited by a space); for each word ...
if(w.startsWith(p)) // ... test whether p is a prefix ...
System.out.println(w.substring(p.length())); // ... if it is, output the suffix
}
#Java 10, 94 bytes
p->s->{for(var w:s.split(" "))if(w.startsWith(p))System.out.println(w.substring(p.length()));}
Try it online here.
Ungolfed:
p -> s -> { // lambda taking prefix and text as Strings in currying syntax
for(var w:s.split(" ")) // split the String into words (delimited by a space); for each word ...
if(w.startsWith(p)) // ... test whether p is a prefix ...
System.out.println(w.substring(p.length())); // ... if it is, output the suffix
}
Java 10, 94 bytes
p->s->{for(var w:s.split(" "))if(w.startsWith(p))System.out.println(w.substring(p.length()));}
Try it online here.
Ungolfed:
p -> s -> { // lambda taking prefix and text as Strings in currying syntax
for(var w:s.split(" ")) // split the String into words (delimited by a space); for each word ...
if(w.startsWith(p)) // ... test whether p is a prefix ...
System.out.println(w.substring(p.length())); // ... if it is, output the suffix
}
#Java 10, 94 bytes
p->s->{for(var w:s.split(" "))if(w.startsWith(p))System.out.println(w.substring(p.length()));}
Try it online here.
Ungolfed:
p -> s -> { // lambda taking prefix and text as Strings in currying syntax
for(var w:s.split(" ")) // split the String into words (delimited by a space); for each word ...
if(w.startsWith(p)) // ... test whether p is a prefix ...
System.out.println(w.substring(p.length())); // ... if it is, output the suffix
}