var str1 = "123: 456: 789" ; var str2 = str1.split ( ":") [0 ]; Print str2;
// output is 123
The wording is the wording javaScript, but in fact the wording of each language Datong trails, I use the flutter in
Explain the string str1, there is a colon between each of the three numbers, in str2, if we do not [0], it will output [123,456,789] of an array, the resulting output is above 123, because we only the output value of str2 labeled 0, is 123.
If these java C # language to write such a
Str1 = String "123: 456: 789" ; String [] str2 = str1.split ( ":") [0 ]; of System.out.print (str2); // Java output // Conlose.write (str2) ; // C # so the output should be, do not too long, not remember // output is 123