Vector类在中间插入字符串
来源:互联网 发布:线切割锥度怎样编程 编辑:程序博客网 时间:2024/06/08 17:36
package test;
import java.util.Scanner;
import java.util.Vector;
public class VectorTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
Vector vct=new Vector();
Scanner reader=new Scanner(System.in);
System.out.println("请输入字符串以输入end作为结束");
String str;
do{
str=reader.next();
vct.addElement(str);
} while (!str.equals("end"));
System.out.println("显示您输入的所有字符串:");
System.out.println(vct.toString());
vct.insertElementAt("NICE", vct.capacity()/2);
System.out.println("显示插入NICE后的字符串");
System.out.println(vct.toString());
}
}
import java.util.Scanner;
import java.util.Vector;
public class VectorTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
Vector vct=new Vector();
Scanner reader=new Scanner(System.in);
System.out.println("请输入字符串以输入end作为结束");
String str;
do{
str=reader.next();
vct.addElement(str);
} while (!str.equals("end"));
System.out.println("显示您输入的所有字符串:");
System.out.println(vct.toString());
vct.insertElementAt("NICE", vct.capacity()/2);
System.out.println("显示插入NICE后的字符串");
System.out.println(vct.toString());
}
}
阅读全文
0 0
- Vector类在中间插入字符串
- 在字符串定义时,在字符串中间插入'\0'字符
- C# 在指定字符串中间插入换行符
- 在表中间插入列名
- 如何在菜单项中间插入一项
- 关于不用任何中间变量快速插入字符串的方法
- RecycleView在中间“插入”布局以及添加头部的姿势
- 在字符串中随机插入字符串
- 在字符串中的特定位置插入字符串
- 在字符串指定位置插入字符串
- 在指定字符串后面插入字符串
- 链表中间插入
- 汇编——在屏幕中间显示不同颜色的字符串
- vector里插入类的对象
- 3.vector实现字符串类
- 利用CString类对字符串进行任意的操作,如字符的匹配或在字符串中间开始进行添加字符串
- vector<pair<int,int> >的插入排序,字符串中子字符串个数查找
- javascript在html页面插入字符串
- jquery.easydropdown.min.js
- 将Java程序的输出结果写到txt文件中
- [LeetCode]636. Exclusive Time of Functions
- Servlet实现文件上传,可多文件上传
- twelve
- Vector类在中间插入字符串
- 详细解析Raid0、Raid0+1、Raid1、Raid5四者的区别
- 数组习题及详解
- [LeetCode] 31. Next Permutation
- Codeforces Round #425 (Div. 2)
- oracle解决因drop命令生成临时表名的问题(如表分区)
- Java中CAS详解
- Android之UI学习篇:使用GridView实现九宫格的菜单
- 用单独js文件转thinkphp的U函数