public class StringTest {
public static void main(String[] args){
String str1 = "ABCDEFG";
String final1 = str1.substring(2,4);
char final2 = str1.charAt(1);
char final3 = str1.charAt(5);
System.out.println(final1);
System.out.println(final2);
System.out.println(final3);
String str = "A1B2C3D4E5F6G7H8";
// original string numbers replaced without
String final4 = str.replaceAll("\\d+","");
// original string of letters without replacing
String final5 = str.replaceAll("\\D+","");
// The new pure string of letters
String[] str2 = new String[final4.length()];
// The new pure numeric string
int[] num = new int[final5.length()];
// string into the string array
for(int i=0; i<final4.length(); i++){
str2[i] = final4.charAt(i) + "";
}
// Converts a string into integer array
for(int i=0; i<final5.length(); i++){
num[i] = Integer.parseInt(final5.substring(i,i+1));
}
// traverse the new string array
for(String str2s:str2){
System.out.print(str2s);
}
System.out.println();
// iterate new array of integers
for(int nums:num){
System.out.print(nums);
}
}
}
Original: http: //blog.csdn.net/szwangdf/article/details/4177104 1、Java 1-1, an array of strings => String: StringUtils: join (Object [] array, String separator) example: 1-2, the string =&g...
When the string begins with the space, there are vacant elements in the print result There are two types of processing 1. Treat the string to remove the front and tail space 2. Treatment of array air ...
Array as a query condition for select in This article comes from the CSDN blog, please indicate the source: http://blog.csdn.net/believefym/archive/2009/01/15/3791122.aspx...
The split() method is used to split a string into an array of strings. The operation performed by String.split() is the opposite of the operation performed by Array.join....
C++ wants to achieve dynamic array effects like other languages need to use STL container, so the return value is stored in a Vector container, Vector container can access the elements in the queue ...