| |

VerySource

 Forgot password?
 Register
Search
View: 853|Reply: 1

How to tell if one string is contained in another string?

[Copy link]

4

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 United States

Post time: 2020-1-4 17:00:01
| Show all posts |Read mode
str1 = "ddd"
str2 = "dddccc"
str1 is included in str2, how to write it with code? THKS
Reply

Use magic Report

0

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-4 17:24:01
| Show all posts
string str1 = "ddd";
string str2 = "dddccc";

if (str2.IndexOf (str1)> -1)
{
Console.WriteLine ("contains");
}
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list