Remove non-alphanumberic Text Cleaner Software golang fyne

Remove non-alphanumberic Character Text Cleaner Software golang fyne
https://youtu.be/b-QIdXewmz8
Source Code


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


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: