Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions docs/ACKNOWLEDGEMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Utility.Test/GuidGeneratorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void MultipleDeleteShouldBeEmpty()
{
var cut = RenderComponent<GuidGenerator>();
cut.FindAll("button")[5].Click();
string markup = "<textarea id=\"guids\" class=\"form-control\" value=\"\" ></textarea>";
string markup = "<textarea id=\"guids\" class=\"form-control\" rows=\"5\" value=\"\"></textarea>";
cut.FindAll("textarea")[0].MarkupMatches(markup); // guids
}

Expand Down
20 changes: 20 additions & 0 deletions src/Utility.Test/RegexFromStringTest.cs
Original file line number Diff line number Diff line change
@@ -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<RegexFromString>();
cut.FindAll("button")[0].Click();

RegexFromString regexFromString = cut.Instance;
Assert.Equal(regexFromString.Output, string.Empty);
}
}
5 changes: 5 additions & 0 deletions src/Utility.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Utility/Components/GuidGenerator/GuidGenerator.razor
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</div>
</div>
<div class="row">
<textarea id="guids" class="form-control" @bind="NewGuids" rows="5"></textarea>
<textarea id="guids" class="form-control" @bind="NewGuids" rows="@guidCount"></textarea>
</div>
</div>

Expand Down
85 changes: 85 additions & 0 deletions src/Utility/Components/Regex/RegexFromString.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
@using System.Text
@using Fare
@inject IJSRuntime JSRuntime

<div class="container">
<div class="row">
<div class="col">

<label class="label-control">Regular Expression:</label>
<div class="input-group">
<input type="regularExpression" id="regularExpression" name="regularExpression" class="form-control" @bind="RegularExpression">
</div>

</div>

<div class="col">

<label class="label-control">Count:</label>
<div class="input-group">
<input type="count" id="count" name="count" class="form-control" @bind="Count">
</div>

</div>

</div>

<div class="row">
<div class="col">
<button id="Generate" name="Generate" @onclick="Generate" class="btn btn-success float-right">Generate</button>
</div>
</div>

<div class="row">
<div class="col">
<div class="input-group">
<textarea id="output" class="form-control" rows="@Count" @bind="Output"></textarea>
<span class="input-group-btn">
<button id="btnCopy" name="btnCopy" class="btn btn-info float-right" @onclick="Copy"><i class="far fa-copy"></i></button>
</span>
</div>
</div>
</div>

<div class="row">
<div class="col">
<p>Inspired from <a href="https://onlinestringtools.com/generate-string-from-regex" target="_blank">String from Regex Generator</a></p>
</div>
</div>

</div>

@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);
}
}
Empty file.
1 change: 1 addition & 0 deletions src/Utility/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<li><a href="binary">Binary</a></li>
<li><a href="stringconverter">String</a></li>
<li><a href="stringconverter">Base64 Encode/Decode</a></li>
<li><a href="stringconverter">Regex From String</a></li>
<li><a href="epoch">Epoch</a></li>
<li><a href="converter">time converter</a></li>
<li><a href="converter">kb - mb - gb converter</a></li>
Expand Down
9 changes: 7 additions & 2 deletions src/Utility/Pages/StringConvertor.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

@using Utility.Components.StringConverter
@using Utility.Components.Base64
@using Utility.Components.Regex

<PageTitle>String Converter</PageTitle>
<PageTitle>String Tools</PageTitle>

<h1>String Converter</h1>
<h1>String Tools</h1>

<RegexFromString />

<hr/>

<Base64 Input="QWxleEhlZGxleQ==" />

Expand Down
1 change: 1 addition & 0 deletions src/Utility/Utility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
<PackageReference Include="BlazorMonaco" Version="3.3.0" />
<PackageReference Include="Fare" Version="2.2.1" />
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.14" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.11" PrivateAssets="all" />
Expand Down
Loading