当前位置:网站首页>The values in the array into another array, and capital
The values in the array into another array, and capital
2022-08-06 08:53:00 【This friend from Shanghai】
数组里的值放到另一个数组中,并转大写
1,方式一 (简单比较常见)
public static void test1(){
String[] strings1 = new String[]{
"hello","world","wd","asd"};
String[] strings2 = new String[strings1.length];
for (int i = 0; i < strings1.length; i++) {
strings2[i] = strings1[i].toUpperCase();
}
for (String s : strings2) {
System.out.println(s);
}
}
方式2 转集合后再转进行操作
static int i = 0;
public static void test1(){
String[] strings1 = new String[]{
"hello","world","wd","asd"};
String[] strings2 = new String[strings1.length];
Arrays.stream(strings1).collect(Collectors.toList()).forEach(s -> {
strings2[i++] = s.toUpperCase();
});
}
边栏推荐
- Advanced Programming in UNIX Environment - Chapter 2
- 21天学习挑战赛--第三天打卡(动态更换app图标)
- VLAN experiment
- Can the code signing certificate solve the software being alerted by antivirus software?
- LeetCode - 1047. Remove all adjacent duplicates in a string
- 第十九章 自动化理论
- MySQL的基本操作--创建数据库及删除数据库
- How much is a code signing certificate?
- Exchange comprehensive experiment (to be supplemented)
- 《nlp入门+实战:第九章:循环神经网络》
猜你喜欢
随机推荐
Jetpack WorkManager is enough to read this article~
yum离线安装
老人没有继承人,其去世后房屋应归谁?
用C写小游戏(扫雷)
Native js implements table table
数据安全法在企业如何落地?
Xshell download crack, the history of the most simple tutorial
21天学习挑战赛--第三天打卡(动态更换app图标)
Page Loading Animation_Gradient Color Rotating Small Circle
Parameter ‘courseId’ not found. Available parameters are [arg1, arg0, param1, para
Linux——MySQL安装的几种方式
ROS报错[rospack] Error: package ‘.....‘ not found
QianBase Operation and Maintenance Practical Commands
Advanced Programming in UNIX Environment - Chapter 2
软件测试八款优秀的API安全测试工具,会用三款工作效率能提升50%
项目运维工作的心得总结
How to improve the quality of articles without being "recommended and affected" by the post assistant
VLAN experiment
Mysql索引简易教程
qwqの科技flag






![[图]Edge 104稳定版发布:引入“增强安全模式”](/img/1a/577a914dd579ee7ce8e2b077e56188.jpg)


