Skip to content

Instantly share code, notes, and snippets.

@hyphop
Created May 12, 2018 17:38
Show Gist options
  • Save hyphop/1300281a4e57cdf2e2566e1ab2754434 to your computer and use it in GitHub Desktop.
Save hyphop/1300281a4e57cdf2e2566e1ab2754434 to your computer and use it in GitHub Desktop.
go test 1
package main
import "fmt"
import "unicode/utf8"
import "regexp"
/*
#include <stdio.h>
#include <errno.h>
void cprint( _GoString_ s)
{
printf( "from C: %s | from GO: %s, %lu\n", "hello/ТЕСТ", _GoStringPtr(s), _GoStringLen(s));
}
*/
import "C"
func main() {
//_, err :=
C.cprint("im ГО\x00")
re := regexp.MustCompile("\\p{Cyrillic}");
s := "Проверяем юникод 123 hello"
s = re.ReplaceAllString(s, "=$0")
fmt.Printf("%s %d %d\n", s, len(s), utf8.RuneCountInString(s) )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment