Click here to Skip to main content
15,905,229 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Find if a String2 is substring of String1. If it is, return True. else return False.

Sample Input 1 

thistest123string

123

Sample Output 1 

True


What I have tried:

Find if a String2 is substring of String1. If it is, return True. else return False.

Sample Input 1 

thistest123string

123

Sample Output 1 

True
Posted
Updated 2-May-23 4:12am
Comments
0x01AA 2-May-23 10:04am    
Looks like you tried nothing. Read this: Python String find() method - GeeksforGeeks[^]

And to get true or false simply compare the return value >= 0
Dave Kreskowiak 2-May-23 12:51pm    
So were you going to ask a question or spell out a problem you're having?

Doing your homework for you is not an option.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900