Helpers

Introduction

To use these methods and features, do not forget to put this line of code in your "using" region:

C#

using LeoCorpLibrary;

VB

Imports LeoCorpLibrary

Methods

a. IsUrlValid

This function is available in version 3.11 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The IsUrlValid() method allows you to check if a specified URL is valid or not. It return a double value.

It's in:

LeoCorpLibrary.Helpers.IsUrlValid()

This method has one argument:

TypeArgumentDescription
stringurlThe URL to check

Here's an example of usage:

C#

bool isValid = Helpers.IsUrlValid("https://leocorporation.dev/");
// isValid = true

VB

Dim isValid As Boolean = Helpers.IsUrlValid("https://leocorporation.dev/")
' isValid = true

Go to top

b. GetUrlProtocol

This function is available in version 3.11 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetUrlProtocol() method allows you to get the protocol of an URL. It returns a string value.

It's in:

LeoCorpLibrary.Helpers.GetUrlProtocol()

This method has one argument:

TypeArgumentDescription
stringurlThe URL to parse

Here's an example of usage:

C#

string protocol = Helpers.GetUrlProtocol("https://leocorporation.dev/");
// protocol = "https"

VB

Dim protocol As String = Helpers.GetUrlProtocol("https://leocorporation.dev/")
' protocol = "https"

Go to top

c. IsUrlHttps

This function is available in version 3.11 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The IsUrlHttps() method allows you to check if the URL's protocol is equal to "https". It return a bool value.

It's in:

LeoCorpLibrary.Helpers.IsUrlHttps()

This method has one argument:

TypeArgumentDescription
stringurlThe URL to check

Here's an example of usage:

C#

bool isHttps = Helpers.IsUrlHttps("https://leocorporation.dev/");
// isHttps = true

bool isHttps2 = Helpers.IsUrlHttps("http://leocorporation.dev/");
// isHttp2s = false

VB

Dim isHttps As Boolean = Helpers.IsUrlHttps("https://leocorporation.dev/")
' isHttps = true

Dim isHttps2 As Boolean = Helpers.IsUrlHttps("http://leocorporation.dev/")
' isHttp2s = false

Go to top