Remove non-alphanumberic Text Cleaner Software golang fyne

Remove non-alphanumberic Character Text Cleaner Software golang fyne
Source Code
<div>package main</div>
<div>import (</div>
<div>    "image/color"</div>
<div>    "regexp"</div>
<div>    ""</div>
<div>    ""</div>
<div>    ""</div>
<div>    ""</div>
<div>var nonAlphaNumericRegex = regexp.MustCompile(`[^a-zA-Z0-9 ]+`)</div>
<div>func cleanText(str string) string {</div>
<div>    return nonAlphaNumericRegex.ReplaceAllString(str, "")</div>
<div>func main() {</div>
<div>    a := app.New()</div>
<div>    w := a.NewWindow("Remove Non-AlphaNumeric")</div>
<div>    // get dirty text from user</div>
<div>    in := widget.NewEntry()</div>
<div>    in.PlaceHolder = "Enter your data here"</div>
<div>    l2 := canvas.NewText("Remove Non-AlphaNumeric Character",</div>
<div>        color.RGBA{R: 255, G: 0, B: 0, A: 255})</div>
<div>    l2.TextSize = 19</div>
<div>    clean_data := widget.NewMultiLineEntry()</div>
<div>    btn := widget.NewButton("Remove", func() {</div>
<div>        var str = in.Text</div>
<div>        //fmt.Println(clearString(str))</div>
<div>        clean_data.Text = cleanText(str)</div>
<div>        clean_data.Refresh()</div>
<div>    })</div>
<div>    w.SetContent(container.NewVBox(l2, in, widget.NewLabel("Clean Text"), clean_data, btn))</div>
<div>    w.ShowAndRun()</div>
Tony BB

TonyBB is a Coach , marketer, hypnotist and a founder of RSKVF Production who specializes in providing simple, affordable, and easy to use solutions for Life.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: