Hi
OS:Win10 (chcp 65001)
It works well :
var s:string
s="almő"
echo(s)
result : "almő"
It doesn't work :
var s:string
s="őalma" #first character UTF-8
echo(s)
result : ""
Than you Attila
Thank both of you
So this is the memory address of the first char :
echo repr(cast[ptr char](addr(s1[0])))
and s1 is internally a pointer, but we can't handle it as a pointer
thank you again
thanks mashingan :
But in which memory adress can i see 'a' ? ('a' is first character of "alma")
ref 0042F8A8 --> 02670058"alma"
Hello
Still the pointer problem
I try this :
var a1 : int = 111
echo repr(a1)
echo repr(a1.addr())
var s1 : string = "alma"
echo repr(s1)
echo repr(s1.addr())
i get this :
111 < OK
Ok thanks both of you to clarify this problem
Thank you
and i accept the second part of your answer, BUT the pointer isn't clear yet
if you try the given example you see :
a[0] ---> 'a'
p[0] ---> 'a' too. <\-- why not similar thing like ('*'p)[0] because p and a
are different things
in GOLANG :
> var s string = "alma"
> p:=&s
// fmt.P
Hello
I have tried it :
var
a = "abc"
p: ptr string
echo(repr(a))
echo(repr(addr(a)))
p = addr(a) #The question : why not p = a ?
echo(repr(p))
echo(repr(addr(p)))
echo(a[0])
echo(p[0])
Thanks DOM96 and Araq
This Works
Hi
I'm absolute beginner with NIM - this is my first day, so maybe my question is
amateur.
I tried the next : echo "kőrte" (file is UTF8) & Win10
But i always get : kőrte
What's wrong with it ?
Thank you Attila