这个问题是针对perl的。
例如,如果我有"hello.world"指定的字符是'.'那么我想要的结果是"hello".
"hello.world"
'.'
"hello"
See perldoc -f index http://p3rl.org/index:
$x = "hello.world"; $y = substr($x, 0, index($x, '.'));