我在这里有一个PHP代码
fileListBox.Items.AddRange(Properties.Settings.Default.FileList.Split(new[] { ';' },StringSplitOptions.RemoveEmptyEntries));
现在我想获得如下输出
G[G$Value < 1000, "Value"] <- G[G$Value < 1000, "Value"]*100
请帮助我在PHP中进行操作
答案 0 :(得分:1)
类似....
<?php
$data = "Called Number Call Type Call Time Call Duration Call Charges
9231332454834 SMS2/5/2019 9:31:15
AM-- Minutes 0.00 PKR 9230374555790 SMS2/4/2019 8:42:07
PM-- Minutes 0.00 PKR
";
preg_match_all ( "/\d{5,13}/", $data, $matches );
print_r ( $matches[0] );
?>
答案 1 :(得分:1)
您可以使用preg_match_all()
进行操作。从我的角度来看,具有php函数(例如array_filter()
<?php
$txtnum = "Called Number Call Type Call Time Call Duration Call Charges 9231332454834 SMS2/5/2019 9:31:15 AM-- Minutes 0.00 PK 9230374555790 SMS2/4/2019 8:42:07 PM-- Minutes 0.00 PKR";
$words = explode(' ', $txtnum);
$result = array_filter($words, 'ctype_digit');
echo implode(PHP_EOL, $result);
?>
输出:
9231332454834
9230374555790