216 Kleopatra 在黎明的天空中可見,在 23:11 (KST) 升起并達到東南地平線以上 52° 的高度,然后在 03:51 左右黎明破曉時從視野中消失。
從這個字串我想得到像 [216, 23, 11, 52, 3, 51] 這樣的數字陣列
我怎么才能得到它?
uj5u.com熱心網友回復:
您可以將 split("\D ") 與正則運算式一起使用
https://www.onlinegdb.com/FCFoH2gNS
這是我制作的代碼
public class Main
{
public static void main(String[] args) {
System.out.println("Hello, World!");
String text ="216 Kleopatra is visible in the dawn sky, rising at 23:11 (KST) and reaching an altitude of 52 \u00B0 above the south-eastern horizon before fading from view as dawn breaks around 03:51.";
System.out.println(text);
String[] textarr= text.split("\\D ");
for(int i = 0 ; i<textarr.length;i ){
System.out.println(textarr[i] "\n");
}
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/492573.html
