scgotils

package module
v0.0.0-...-85a12fc Latest Latest
Warning

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

Go to latest
Published: May 21, 2018 License: LGPL-3.0 Imports: 9 Imported by: 2

README

scgotils

Here i will put all my Golang utility codes that i already use on my own projects.

Documentation

Overview

Author:

Carlos Timoshenko
carlostimoshenkorodrigueslopes@gmail.com

https://github.com/softctrl

This project is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

Author:

Carlos Timoshenko
carlostimoshenkorodrigueslopes@gmail.com

https://github.com/softctrl

This project is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

Index

Constants

View Source
const (
	JOINED_VALUES_FMT        = "%s"
	JOINED_QUOTED_VALUES_FMT = "[%s]"
	EMPTY_ARRAY              = "[]"
	QUOTE                    = '"'
	COMMA                    = ','
)

Variables

View Source
var DUPLICATED_SPACES_PATTERN = rgx.MustCompile("\\s+")

This pattern will matches duplicated spaces occurencies.

View Source
var INTEGER_PATTERN = rgx.MustCompile("^\\d+$")

This pattern will only matche a valid integer value.

View Source
var IP_ADDRESS_PATTERN = rgx.MustCompile("^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}$")

This pattern will matches only valis IPV6 Address. Based on: https://stackoverflow.com/questions/15875013/extract-ip-addresses-from-strings-using-regex

View Source
var NON_WORDS_PATTERN = rgx.MustCompile("[^a-zA-Z0-9-. \"]+")

It will mathces only symbols there is not from a to Z, 0 to 9, ., space and (").

Functions

func CalculateSCSW

func CalculateSCSW(__word1, __word2 string) float64

Calculate the similarity of two words, under the SC Algorithm :D

func Contains

func Contains(_slice []string, _value string) bool

Contains inform if a value string is present into a slice of strings.

func Dim

func Dim(x, y int) int

Dim returns the maximum of x-y or 0.

func IntToIp

func IntToIp(__ip int64) string

IntToIp parses an Ip address on in format to his valid string representation. Based on: https://github.com/softctrl/sc-utils-java/blob/master/sc-utils-java/src/main/java/br/com/softctrl/utils/IpUtils.java

func IsEmpty

func IsEmpty(__value string) bool

Validate when an informed string is empty.

func IsInteger

func IsInteger(__value string) bool

Validate if the informed string value can be parsed to a valid integer value.

func IsIpAddress

func IsIpAddress(__ip string) bool

func Join

func Join(__values []string, sep string) string

func JoinQuoted

func JoinQuoted(__values []string, sep string) string

func Json_Unmarshal_Array

func Json_Unmarshal_Array(data []byte) ([]map[string]*json.RawMessage, error)

Json_Unmarshal_Array utilitary method.

func Json_Unmarshal_Object

func Json_Unmarshal_Object(data []byte) (map[string]*json.RawMessage, error)

Json_Unmarshal_Object utilitary method.

func Max

func Max(_x, _y int) int

Max returns the larger of x or y.

func Min

func Min(_x, _y int) int

Min returns the smaller of x or y.

func Quoted

func Quoted(__value []byte) []byte

func QuotedString

func QuotedString(__value string) string

func RemoveAccents

func RemoveAccents(__value []byte) []byte

Remove all accents from an informed byte array Based on: https://gist.github.com/tkrajina/d423e9b9fc2e72d63072

func RemoveAccentsString

func RemoveAccentsString(__value string) string

Remove all accents from an informed string

func RemoveDuplicatedSpaces

func RemoveDuplicatedSpaces(__value string) string

Remove all duplicated spaces from an informed string

func RemoveNonWords

func RemoveNonWords(__value string) string

Types

This section is empty.

Directories

Path Synopsis
Package sendmail allow user to send emails to a smpt server.
Package sendmail allow user to send emails to a smpt server.

Jump to

Keyboard shortcuts

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