htmlHelpers

package
v1.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 5 Imported by: 2

README

htmlHelpers

htmlHelpers provides small helpers for HTML value conversion and URL-safe encoding/decoding.

Functions

Function Description
ValueToInt(s string) int Converts an HTML form value to an int
ValueToBool(s string) bool Returns true if the value is "on"
BoolToValue(b bool) string Returns "on" or "off"
ToPathSafe(s string) (string, error) URL-escapes then base64-encodes a string for safe use in URL paths
FromPathSafe(s string) (string, error) Reverses ToPathSafe

Example

import "github.com/mt1976/frantic-core/htmlHelpers"

func main() {
    safe, _ := htmlHelpers.ToPathSafe("Hello World/123")
    original, _ := htmlHelpers.FromPathSafe(safe)
    fmt.Println(original) // "Hello World/123"

    fmt.Println(htmlHelpers.ValueToBool("on"))  // true
    fmt.Println(htmlHelpers.BoolToValue(false))  // "off"
}

Documentation

Overview

Package htmlHelpers provides small helpers for generating and working with HTML fragments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToValue added in v1.3.4

func BoolToValue(b bool) string

func FromPathSafe

func FromPathSafe(s string) (string, error)

func ToPathSafe

func ToPathSafe(s string) (string, error)

func ValueToBool

func ValueToBool(s string) bool

func ValueToInt

func ValueToInt(s string) int

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL