-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some improvments in both: HeroldSpider + GelbeSeitenSpider
- Loading branch information
Showing
8 changed files
with
72 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,42 @@ | ||
namespace LarchSys.Bot { | ||
using System.Text.RegularExpressions; | ||
|
||
|
||
namespace LarchSys.Bot { | ||
public class SearchResult { | ||
public string Name { get; set; } | ||
public string Address { get; set; } | ||
public Address Address { get; set; } | ||
public string Tel { get; set; } | ||
public string Url { get; set; } | ||
public string Category { get; set; } | ||
public string Img { get; set; } | ||
public string Email { get; set; } | ||
public string Website { get; set; } | ||
} | ||
|
||
public class Address { | ||
public string StreatLine { get; set; } | ||
public string ZipLine { get; set; } | ||
|
||
private static Regex _regex; | ||
private static Regex Regex => _regex ??= new Regex(@"(\d{4}\d*.*)$", RegexOptions.Multiline | RegexOptions.Compiled); | ||
|
||
public static Address Parse(string address) | ||
{ | ||
if (string.IsNullOrEmpty(address)) { | ||
return new Address(); | ||
} | ||
|
||
var match = Regex.Match(address); | ||
if (match.Success) { | ||
return new Address { | ||
StreatLine = address.Substring(0, match.Groups[1].Index), | ||
ZipLine = match.Groups[1].Value | ||
}; | ||
} | ||
|
||
return new Address { | ||
StreatLine = address, | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters