Created
May 12, 2018 17:38
-
-
Save hyphop/1300281a4e57cdf2e2566e1ab2754434 to your computer and use it in GitHub Desktop.
go test 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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