生而为人

程序员的自我修养

0%

“message”: “C# error CS1061: ‘DateTime?’ does not contain a definition for ‘AddHours’ and no accessible extension method ‘AddHours’ accepting a first argument of type ‘DateTime?’ could be found (are you missing a using directive or an assembly reference?)”,

类后面有? 类似scala的Option,需要先get,获取的才是DateTime对象,然后再调用其函数

代码整理

  1. string 相关方法(Contains/indexOf)
  2. 类型转换
  3. 字节数组 <-> 字符串 (编码) 示例

下载go安装包

修改GoPath,可以使用默认的

go env 可以查看当前配置项内容

运行代码需要在%GoPath%/src/xx 下面

当需要引入包时,执行go get -u <package_name>

go mod init

go mod tiny

go build xxx.go

interface 属性为 private static final

abstract 父类中的属性,默认式private的,非private的在子类中可以使用

joda.time

1
2
String pattern ="dd-MMM-yy hh.mm.ss aa";
DateTimeFormat.forPattern(pattern)

字符串补位

1
"%02d".format(currentTime.getMinuteOfHour)