func IsInt(s string) bool {
	for i, c := range s {
		if (c < '0' || c > '9') && (c != '-' || i != 0) {
			return false
		}
	}
	return true
}
IsInt returns true if the given string can be converted to an integer.
The string must contain no whitespaces.
package tstrings
import (
	"encoding/json"
	"fmt"
	"math"
	"reflect"
	"strconv"
	"strings"
	"unsafe"
)
var simpleEscapeChars = strings.NewReplacer("\\n", "\n", "\\r", "\r", "\\t", "\t", "\\f", "\f", "\\b", "\b")
var jsonEscapeChars = strings.NewReplacer("\\", "\\\\", "\"", "\\\"", "\\n", "\n", "\\r", "\r", "\\t", "\t", "\\f", "\f", "\\b", "\b")
func Unescape(text string) string {
	return simpleEscapeChars.Replace(text)
}
func EscapeJSON(text string) string {
	return jsonEscapeChars.Replace(text)
}
func ItoLen(number uint64) int {
	switch {
	case number < 10:
		return 1
	default:
		return int(math.Log10(float64(number)) + 1)
	}
}
func Itob(number uint64, buffer []byte) error {
	numberLen := ItoLen(number)
	bufferLen := len(buffer)
	if numberLen > bufferLen {
		return fmt.Errorf("Number too large for buffer")
	}
	for i := numberLen - 1; i >= 0; i-- {
		buffer[i] = '0' + byte(number%10)
		number /= 10
	}
	return nil
}
func Itobe(number uint64, buffer []byte) error {
	for i := len(buffer) - 1; i >= 0; i-- {
		buffer[i] = '0' + byte(number%10)
		number /= 10
		if number == 0 {
			return nil
		}
	}
	return fmt.Errorf("Number too large for buffer")
}
func Btoi(buffer []byte) (uint64, int) {
	number := uint64(0)
	index := 0
	bufferLen := len(buffer)
	for index < bufferLen && buffer[index] >= '0' && buffer[index] <= '9' {
		parsed := uint64(buffer[index] - '0')
		number = number*10 + parsed
		index++
	}
	return number, index
}
func IndexN(s, sep string, n int) int {
	sepIdx := 0
	for i := 0; i < n; i++ {
		nextIdx := strings.Index(s[sepIdx:], sep)
		if nextIdx == -1 {
			return -1  
		}
		sepIdx += nextIdx + 1
	}
	return sepIdx - 1
}
func LastIndexN(s, sep string, n int) int {
	if n == 0 {
		return -1  
	}
	sepIdx := len(s)
	for i := 0; i < n; i++ {
		sepIdx = strings.LastIndex(s[:sepIdx], sep)
		if sepIdx == -1 {
			return -1  
		}
	}
	return sepIdx
}