mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-07 11:04:17 +00:00
#rune "" to ''; Remove infix and postfix call notation
This commit is contained in:
@@ -1,5 +1,34 @@
|
||||
#import "fmt.odin"
|
||||
#import "utf8.odin"
|
||||
|
||||
main :: proc() {
|
||||
fmt.println("Hellope, World!")
|
||||
MAX :: 64
|
||||
buf: [MAX]rune
|
||||
backing: [MAX]byte
|
||||
offset: int
|
||||
|
||||
msg := "Hello"
|
||||
count := utf8.rune_count(msg)
|
||||
assert(count <= MAX)
|
||||
runes := buf[:count]
|
||||
|
||||
offset = 0
|
||||
for i := 0; i < count; i++ {
|
||||
s := msg[offset:]
|
||||
r, len := utf8.decode_rune(s)
|
||||
runes[count-i-1] = r
|
||||
offset += len
|
||||
}
|
||||
|
||||
offset = 0
|
||||
for i := 0; i < count; i++ {
|
||||
data, len := utf8.encode_rune(runes[i])
|
||||
for j := 0; j < len; j++ {
|
||||
backing[offset+j] = data[j]
|
||||
}
|
||||
offset += len
|
||||
}
|
||||
|
||||
reverse := backing[:count] as string
|
||||
fmt.println(reverse)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#import "os.odin"
|
||||
#import "opengl.odin" as gl
|
||||
|
||||
TWO_HEARTS :: #rune "💕"
|
||||
TWO_HEARTS :: '💕'
|
||||
|
||||
win32_perf_count_freq := win32.GetQueryPerformanceFrequency()
|
||||
time_now :: proc() -> f64 {
|
||||
|
||||
Reference in New Issue
Block a user