Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

valid url in .net

//Try this to validate HTTP URLs (url is the URI you want to test):
//
	// Checks how well a url validator does against a known list of valid and invalid Urls
	// The sample urls here are from http://formvalidation.io/validators/uri
	//	
// test 
/// in text this only one that most low (17) error
public static bool UrlChecker5(string url)
	{
		Uri uriResult;
		bool result = Uri.TryCreate(url, UriKind.Absolute, out uriResult) 
			&& (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
       return result;
	}
// and than (17)

public static bool UrlChecker2(string url)
	{
		return Uri.IsWellFormedUriString(url, UriKind.Absolute);
	}
// if we combine both with like UrlChecker5(url) && UrlChecker2(url)
// error become lowest 15 error

Comment

valid URL check in c#

public static bool CheckURLValid(this string source) => Uri.TryCreate(source, UriKind.Absolute, out Uri uriResult) && uriResult.Scheme == Uri.UriSchemeHttps;
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity set active for seconds 
Csharp :: sqrt unity 
Csharp :: Create gaps / headers between variables in the unity inspector 
Csharp :: remove all letters from string c# 
Csharp :: instantiate scale object 
Csharp :: c# datetime get number of week 
Csharp :: exit a method c# 
Csharp :: oncollisionenter compare tag 
Csharp :: unity object to mouse position 
Csharp :: transform.rotate unity 
Csharp :: c# datetimepicker set weeks before today 
Csharp :: c# sql duplicate key exception 
Csharp :: c# paste from clipboard 
Csharp :: c# @ before string 
Csharp :: basic movement script unity 
Csharp :: how to make teleporter in unity 
Csharp :: public GameObject 
Csharp :: parse int in c# 
Csharp :: bootstrap modal 
Csharp :: c# average of 3 numbers 
Csharp :: fluentassertions force exceptions 
Csharp :: c# list append 
Csharp :: unity random range 
Csharp :: c# split a string and return list 
Csharp :: weighted random c# 
Csharp :: c# split on multiple characters 
Csharp :: c# byte array to bitmap 
Csharp :: add object to list c# 
Csharp :: how to make a mouse down condition in unity 
Csharp :: c# remove duplicates from datatable 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =