diff --git a/README.md b/README.md index 143e649b..97c708ae 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ Utility Web App written in Blazor WebAssembly (WASM) - Url Encode - Url - Guid +- Regex from String - SQL (IN Clause / LIKE) - Luhn - Hidden Char Finder ([Original](https://www.soscisurvey.de/tools/view-chars.php) [Source](https://github.com/BurninLeo/see-non-printable-characters/blob/main/view-chars.php)) diff --git a/docs/ACKNOWLEDGEMENTS.md b/docs/ACKNOWLEDGEMENTS.md index da4c004d..e3ae91d7 100644 --- a/docs/ACKNOWLEDGEMENTS.md +++ b/docs/ACKNOWLEDGEMENTS.md @@ -8,6 +8,7 @@ - Humanizer - Blazored.LocalStorage - [BlazorMonaco](https://github.com/serdarciplak/BlazorMonaco) +- Fare - OpenIconic https://www.appstudio.dev/app/OpenIconic.html - https://github.com/iconic/open-iconic diff --git a/src/Utility.Test/GuidGeneratorTest.cs b/src/Utility.Test/GuidGeneratorTest.cs index 845cdb3e..8828a22f 100644 --- a/src/Utility.Test/GuidGeneratorTest.cs +++ b/src/Utility.Test/GuidGeneratorTest.cs @@ -100,7 +100,7 @@ public void MultipleDeleteShouldBeEmpty() { var cut = RenderComponent(); cut.FindAll("button")[5].Click(); - string markup = ""; + string markup = ""; cut.FindAll("textarea")[0].MarkupMatches(markup); // guids } diff --git a/src/Utility.Test/RegexFromStringTest.cs b/src/Utility.Test/RegexFromStringTest.cs new file mode 100644 index 00000000..186ed86b --- /dev/null +++ b/src/Utility.Test/RegexFromStringTest.cs @@ -0,0 +1,20 @@ +using Bunit; +using Utility.Components.Regex; +using Xunit; + +namespace Utility.Test; + +public class RegexFromStringTest: TestContext +{ + public RegexFromStringTest() {} + + //[Fact] + public void RegexFromString_EmptyString_EmptyString() + { + var cut = RenderComponent(); + cut.FindAll("button")[0].Click(); + + RegexFromString regexFromString = cut.Instance; + Assert.Equal(regexFromString.Output, string.Empty); + } +} \ No newline at end of file diff --git a/src/Utility.sln b/src/Utility.sln index 9ebaed86..7231b46c 100644 --- a/src/Utility.sln +++ b/src/Utility.sln @@ -12,6 +12,11 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{53EC20CC-B77E-4620-91E4-90D0FA828C52}" ProjectSection(SolutionItems) = preProject global.json = global.json + ..\README.md = ..\README.md + ..\docs\ACKNOWLEDGEMENTS.md = ..\docs\ACKNOWLEDGEMENTS.md + ..\docs\CHANGELOG.md = ..\docs\CHANGELOG.md + ..\docs\CONTRIBUTORS.md = ..\docs\CONTRIBUTORS.md + ..\docs\README.md = ..\docs\README.md EndProjectSection EndProject Global diff --git a/src/Utility/Components/GuidGenerator/GuidGenerator.razor b/src/Utility/Components/GuidGenerator/GuidGenerator.razor index 51cfce58..7d923a45 100644 --- a/src/Utility/Components/GuidGenerator/GuidGenerator.razor +++ b/src/Utility/Components/GuidGenerator/GuidGenerator.razor @@ -86,7 +86,7 @@
- +
diff --git a/src/Utility/Components/Regex/RegexFromString.razor b/src/Utility/Components/Regex/RegexFromString.razor new file mode 100644 index 00000000..8390bb09 --- /dev/null +++ b/src/Utility/Components/Regex/RegexFromString.razor @@ -0,0 +1,85 @@ +@using System.Text +@using Fare +@inject IJSRuntime JSRuntime + +
+
+
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+
+
+ + + + +
+
+
+ +
+
+

Inspired from String from Regex Generator

+
+
+ +
+ +@code +{ + [Parameter] + public string Output { get; set; } + + string RegularExpression; + int Count; + + protected override void OnInitialized() + { + RegularExpression = @"\d{1,5}"; + Count = 5; + Output = ""; + } + + private void Generate() + { + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < Count; i++) + { + var xeger = new Xeger(RegularExpression); + var random = xeger.Generate(); + + builder.Append(random + System.Environment.NewLine); + } + + Output = builder.ToString().Trim(); + } + + async Task Copy() + { + await JSRuntime.InvokeVoidAsync("navigator.clipboard.writeText", Output); + } +} \ No newline at end of file diff --git a/src/Utility/Components/Regex/RegexFromString.razor.css b/src/Utility/Components/Regex/RegexFromString.razor.css new file mode 100644 index 00000000..e69de29b diff --git a/src/Utility/Pages/Index.razor b/src/Utility/Pages/Index.razor index 90546843..c81bfe0c 100644 --- a/src/Utility/Pages/Index.razor +++ b/src/Utility/Pages/Index.razor @@ -17,6 +17,7 @@
  • Binary
  • String
  • Base64 Encode/Decode
  • +
  • Regex From String
  • Epoch
  • time converter
  • kb - mb - gb converter
  • diff --git a/src/Utility/Pages/StringConvertor.razor b/src/Utility/Pages/StringConvertor.razor index dfacdc0d..8228faaa 100644 --- a/src/Utility/Pages/StringConvertor.razor +++ b/src/Utility/Pages/StringConvertor.razor @@ -2,10 +2,15 @@ @using Utility.Components.StringConverter @using Utility.Components.Base64 +@using Utility.Components.Regex -String Converter +String Tools -

    String Converter

    +

    String Tools

    + + + +
    diff --git a/src/Utility/Utility.csproj b/src/Utility/Utility.csproj index d1f42444..9f700d3d 100644 --- a/src/Utility/Utility.csproj +++ b/src/Utility/Utility.csproj @@ -9,6 +9,7 @@ +