StartsWith String Function

Based on: .NET 4.5 C# program that invokes StartsWith method

using System;

class Program{

static void Main() {

// The input string. string input = “http://site.com/test.html“;

// See if input matches one of these starts.

if (input.StartsWith(“http://www.site.com“) || input.StartsWith(“http://site.com“))

{

// Write to the screen. Console.WriteLine(true);

}}}

Output True

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: