本文整理汇总了C#中Validator.GetUrl方法的典型用法代码示例。如果您正苦于以下问题:C# Validator.GetUrl方法的具体用法?C# Validator.GetUrl怎么用?C# Validator.GetUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validator
的用法示例。
在下文中一共展示了Validator.GetUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testUrl
private void testUrl( EwfTable table, string url )
{
var validator = new Validator();
validator.GetUrl( new ValidationErrorHandler( "" ), url, false );
table.AddItem(
new EwfTableItem(
url,
( !validator.ErrorsOccurred ).BooleanToYesNo( false )
.ToCell( new TableCellSetup( classes: ( validator.ErrorsOccurred ? CssClasses.Red : CssClasses.Green ).ToSingleElementArray() ) ) ) );
}
示例2: addRowToWorksheet
private void addRowToWorksheet( bool bold, params string[] cellValues )
{
var columnIndex = 1;
foreach( var cellValue in cellValues ) {
var cell = worksheet.Cell( rowIndex, columnIndex++ );
setOrAddCellStyle( cell, bold: bold, textWrapped: true );
var v = new Validator();
var detectedDate = v.GetNullableDateTime(
new ValidationErrorHandler( "" ),
cellValue,
DateTimeTools.DayMonthYearFormats.Concat( DateTimeTools.MonthDayYearFormats ).ToArray(),
false,
DateTime.MinValue,
DateTime.MaxValue );
if( !v.ErrorsOccurred ) {
setOrAddCellStyle( cell, false, date: true );
cell.Value = detectedDate;
continue;
}
v = new Validator();
v.GetEmailAddress( new ValidationErrorHandler( "" ), cellValue, false );
if( !v.ErrorsOccurred ) {
cell.Value = cellValue;
cell.Hyperlink = new XLHyperlink( "mailto:" + cellValue );
continue;
}
v = new Validator();
var validatedUrl = v.GetUrl( new ValidationErrorHandler( "" ), cellValue, false );
if( !v.ErrorsOccurred ) {
cell.Value = cellValue;
cell.Hyperlink = new XLHyperlink( validatedUrl );
continue;
}
cell.Value = cellValue;
}
++rowIndex;
}
示例3: Main
public static void Main()
{
GlobalInitializationOps.InitStatics( new GlobalInitializer(), "Tester", false );
EwlStatics.RunStandardLibraryTests();
Console.WriteLine( new TimeSpan( 0, 0, 0, 0, 4861000 ).ToHourMinuteSecondString() );
Console.WriteLine( new TimeSpan( 0, 0, 0, 0, 4861000 ).ToHourMinuteString() );
Console.WriteLine( new TimeSpan( 0, 0, 0, 0, 104861000 ).ToHourMinuteSecondString() );
Console.WriteLine( new TimeSpan( 0, 0, 0, 0, 104861000 ).ToHourMinuteString() );
Console.WriteLine( new TimeSpan( 1, 2, 3, 4, 0 ).ToHourMinuteSecondString() );
Console.WriteLine( new TimeSpan( 1, 2, 3, 4, 0 ).ToHourMinuteString() );
Console.WriteLine( new TimeSpan( 0, 1, 32 ).ToHourMinuteSecondString() );
Console.WriteLine( FormattingMethods.GetFormattedBytes( 64 ) );
Console.WriteLine( FormattingMethods.GetFormattedBytes( 64000 ) );
Console.WriteLine( FormattingMethods.GetFormattedBytes( 64000000 ) );
Console.WriteLine( FormattingMethods.GetFormattedBytes( 64500000000 ) );
Console.WriteLine( "fred".CapitalizeString() );
Console.WriteLine( "".CapitalizeString() );
Console.WriteLine( "\n".CapitalizeString() );
Console.WriteLine( "f".CapitalizeString() );
Console.WriteLine( "1234f".CapitalizeString() );
Console.WriteLine( "1234".CapitalizeString() );
Console.WriteLine( " f".CapitalizeString() );
Console.WriteLine( " ".CapitalizeString() );
Console.WriteLine( " fred".CapitalizeString() );
Console.WriteLine( " fred died.".CapitalizeString() );
Console.WriteLine( ".".CapitalizeString() );
Console.WriteLine( " .".CapitalizeString() );
Console.WriteLine( " .fred died.".CapitalizeString() );
Console.WriteLine( " . fred died.".CapitalizeString() );
Console.WriteLine( "\nfred".CapitalizeString() );
Console.WriteLine( " \n fred".CapitalizeString() );
Console.WriteLine( "\n------\nfred".CapitalizeString() );
Console.WriteLine( "one two three.csv".ToSafeFileName() );
Console.WriteLine( "One {one one } two {two}".RemoveTextBetweenStrings( "{", "}" ) );
Console.WriteLine( "This 'quoted text'.".RemoveTextBetweenStrings( "'", "'" ) );
Console.WriteLine( "A comments looks like /*A comment.*/.".RemoveTextBetweenStrings( "/*", "*/" ) );
Console.WriteLine( "body.ewf div.ewfIeWarningBanner table a { font-size:1.5em; }".RemoveTextBetweenStrings( "{", "}" ) );
Console.WriteLine( "one".ConcatenateWithSpace( "two" ) );
Console.WriteLine( EnterpriseWebLibrary.StringTools.ConcatenateWithDelimiter( ", ", "one", "two", "three" ) );
Console.WriteLine( EnterpriseWebLibrary.StringTools.ConcatenateWithDelimiter( "|", "", "one", "", "", "two", "", "three ", " " ) );
Console.WriteLine( "abcde".Truncate( 4 ) );
Console.WriteLine( "abcde".TruncateStart( 4 ) );
Console.WriteLine( NetTools.CombineUrls( @"http://www.redstapler.biz", "/Files", "Carriers", "Hancock/", "blabla.pdf" ) );
Console.WriteLine( NetTools.CombineUrls( @"http://www.redstapler.biz", "//Files", "Carriers", "Hancock//", "blabla.pdf//" ) );
Console.WriteLine( NetTools.CombineUrls( @"///http://www.redstapler.biz//", "/Files/", "Carriers/", "Hancock/", "/blabla.pdf/" ) );
Console.WriteLine( NetTools.CombineUrls( @"http://localhost/ToddPublicWebSite/", "Carriers", "UP", "ComparisonLogo.jpg" ) );
Console.WriteLine( EwlStatics.CombinePaths( @"C:\Inetpub\", "Files", "orgs", "box.txt" ) );
Console.WriteLine( EwlStatics.CombinePaths( @"C:\Inetpub\", "Files", "orgs", "anotherFolder", "box.txt" ) );
Console.WriteLine( EwlStatics.CombinePaths( @"C:\Inetpub\", "Files", @"orgs\" ) );
Console.WriteLine( EwlStatics.CombinePaths( @"C:\Inetpub", @"\Files\", @"\orgs", "box.txt" ) );
Console.WriteLine( EwlStatics.CombinePaths( @"Inetpub", @"Files" ) );
Console.WriteLine( EwlStatics.CombinePaths( @"D:\Source Control Repository\Charette", @"", @"\Aspose.Words.lic" ) );
Console.WriteLine( EnterpriseWebLibrary.StringTools.CamelToEnglish( null ) );
Console.WriteLine( "".CamelToEnglish() );
Console.WriteLine( "L".CamelToEnglish() );
Console.WriteLine( "l".CamelToEnglish() );
Console.WriteLine( "LeftLeg".CamelToEnglish() );
Console.WriteLine( "hits you in the Head and the LeftLeg! That hurts.".CamelToEnglish() );
var mySet = new HashSet<string> { "a", "c", "", "b", "fred" };
var list = new List<string>( mySet );
foreach( var item in mySet )
list.Add( item );
// mySet = new Set( list );
var ls = new ListSet<string> { "one", "two", "one", "two" };
foreach( var item in ls )
Console.WriteLine( item );
var validator = new Validator();
var vp = new ValidationErrorHandler( errorWriter );
Console.WriteLine( validator.GetUrl( vp, "hTTp://RedStapler.biZ/fRed", false ) );
Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter );
Console.WriteLine( validator.GetUrl( vp, "fred", true ) );
Assert.IsFalse( vp.LastResult == ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter );
Console.Write( validator.GetNullableSqlSmallDateTimeExact( vp, "fred", "MM/dd/yyy", false ) );
Assert.IsFalse( vp.LastResult == ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter );
Console.WriteLine( validator.GetInt( vp, "fred" ) );
Assert.IsFalse( vp.LastResult == ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter ); // "myGoodInt" );
//.........这里部分代码省略.........