That works perfectly - thanks!
On Tuesday, February 28, 2017 at 1:51:49 AM UTC, brainman wrote:
>
> I would just use syscall.UTF16ToString:
> https://play.golang.org/p/jGmQXHtoRT
>
> Alex
>
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To
Oh, and make wcMax of 0 produce default of max (otherwise it doesn't make
sense to have 0 chars?)
https://play.golang.org/p/2rLtWFGhpW
On Monday, February 27, 2017 at 6:41:50 PM UTC, Mark wrote:
>
> One tiny suggestion s[:i]
>
> https://play.golang.org/p/_T_hqBg6ka
>
> Thanks:-)
>
> On Monday,
One tiny suggestion s[:i]
https://play.golang.org/p/_T_hqBg6ka
Thanks:-)
On Monday, February 27, 2017 at 6:36:06 PM UTC, peterGo wrote:
>
> Mark,
>
> Fixed typos and made minor improvements.
>
> Go Playground: https://play.golang.org/p/cbQL8-72s5
>
> Peter
>
> On Monday, February 27, 2017 at
Peter,
I compared your version with mine on plenty of sample data & they produced
the same results. Although my version seems to do more copying, the
difference between them was += 0.01 sec on each run. However, yours is
simpler and clearer than mine, so I'm now using yours:-)
Thank you!
On
Mark,
For example,
Go Playground: https://play.golang.org/p/dv48PLY-CD
Peter
On Monday, February 27, 2017 at 11:05:32 AM UTC-5, Mark wrote:
>
> Ooops just realised that I didn't enforce the max chars limit. Here's
> another version:
>
> func CwcharToString(p uintptr, maxchars int) string {
>
Ooops just realised that I didn't enforce the max chars limit. Here's
another version:
func CwcharToString(p uintptr, maxchars int) string {
if p == 0 {
return ""
}
uints := make([]uint16, 0, maxchars)
for i, p := 0, uintptr(unsafe.Pointer(p)); i < maxchars; p += 2 {