摘要: 函数参照c#的StringBuilder 1 require "utf8Ext" 2 3 StringBuilder = StringBuilder or {} 4 5 function StringBuilder.new() 6 local inst = {} 7 8 local charBuff 阅读全文
posted @ 2021-11-12 01:03 yanghui01 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 【关于unicode和utf-8】 # unicode字符集,包含了全世界的字符,然而它只是规定了字符的二进制编码,并没有规定二级制编码是如何存储的。utf-8就是unicode的一个实现方式,就是怎么存储和读取这个unicode二进制编码。 就像一张jpg图片,我们可以选择直接存放在硬盘上,也可以 阅读全文
posted @ 2021-11-12 00:58 yanghui01 阅读(1399) 评论(0) 推荐(0) 编辑
摘要: 【参考】 # 实现的很简洁,值得参考 数据结构和算法(Java) - 双端队列(Array) - 知乎 (zhihu.com) local arrayext = require("arrayext") local Deque = {} Deque.__cname = "util.Deque" Deq 阅读全文
posted @ 2021-11-12 00:37 yanghui01 阅读(28) 评论(0) 推荐(0) 编辑
摘要: # 链表节点 local Node = {} Node.__cname = "util.LinkedList.Node" Node.__index = Node function Node.new(list, value) local obj = {} setmetatable(obj, Node) 阅读全文
posted @ 2021-11-12 00:35 yanghui01 阅读(27) 评论(0) 推荐(0) 编辑
摘要: # 使用循环队列的方式 local arrayext = require("arrayext") local Queue = {} Queue.__cname = "util.Queue" Queue.__index = Queue local ClearTypeEnum = { Reset = n 阅读全文
posted @ 2021-11-12 00:29 yanghui01 阅读(33) 评论(0) 推荐(0) 编辑
摘要: local Stack = {} Stack.__cname = "util.Stack" Stack.__index = Stack function Stack.new2(src) assert("util.Stack" == src.__cname, "InvalidArgument: not 阅读全文
posted @ 2021-11-12 00:28 yanghui01 阅读(17) 评论(0) 推荐(0) 编辑
摘要: # 在table的基础山增加了更直观的列表操作函数,同时使用了_count来跟踪元素数量 local list = {} list.__cname = "util.list" local null = {} list.null = null list.__newindex = function(se 阅读全文
posted @ 2021-11-12 00:26 yanghui01 阅读(47) 评论(0) 推荐(0) 编辑