我的价格是int6位数.我希望将它显示为String带有小数点(.)的结尾处的2位数int.我想使用a float但建议String用于更好的显示输出(而不是1234.5将1234.50).因此,我需要一个函数,它将采用intas参数并返回正确格式化String的结尾,小数点为2位数.
说:
int j= 123456
Integer.toString(j);
//processing...
//output : 1234.56
Run Code Online (Sandbox Code Playgroud) 我是shell脚本的新手但遇到这个错误并且无法弄清楚是什么.
sed: 1: "/Users/local/Do ...": extra characters at the end of d command
sed: 1: "/Users/local/Do ...": extra characters at the end of d command
sed: 1: "/Users/local/Do ...": extra characters at the end of d command
sed: 1: "/Users/local/Do ...": extra characters at the end of d command
Run Code Online (Sandbox Code Playgroud)
这是我正在运行的脚本
for fl in $(S_convertPath ${RESOURCE_DIR}/db)/db.changelog-*xml; do
sed -i "s/HOSTNAME/${IP_ADDRESS}/g" $fl
done
Run Code Online (Sandbox Code Playgroud)
谢谢
我有一个jcombobox,其值来自列表.我想从下拉列表中首先看到空白.我接近它的方法是首先将列表类型的新对象放在第一位,如示例所示:
final List<Object> list = getObjectsList();
list.add(new Object());
Run Code Online (Sandbox Code Playgroud)
但这会导致空指针,如果这样做
list.add(null);
Run Code Online (Sandbox Code Playgroud)
这解决了这个问题,但后来又用Comparator方法给了我另一个问题.所以任何一轮工作都会非常感谢.
尝试编写我的第一组 RBAC 角色。因此,试图找出为多个命名空间组件分配两个角色的最佳方法。
管理员角色(RW 对于 3 个命名空间,即默认值,ns1 和 ns2) 用户角色(对于 3 个命名空间,例如默认值,ns1 和 ns2,只读)
我认为需要一个具有 2 个 clusterRoles 的服务帐户用于管理员/用户
apiVersion: rbac.authorization.k8s.io/v1
kind: ServiceAccount
metadata:
name: sa
namespace: default
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: admin-master
rules:
- apiGroups:
- batch
resources:
- pods
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: user-master
rules:
- apiGroups:
- batch
resources:
- pods
verbs: …Run Code Online (Sandbox Code Playgroud)