Perl字符在带有模式的字符串中搜索(Perl character searching in a string with patterns)

是否有内置函数来确定字符串中是否存在字符。 另外,如何确定值是字符串还是数字。

Is there a built in function on which determines if a character is present in a string. Also how can you determine if a value is a string or a number.

最满意答案

在perl中有一个内置函数,称为索引函数也使用模式匹配

使用index:index($ stringvariable,“char to search”); 确定一个数字是否使用代码m / \ d /如果你想确定一个值是否为字符串使用m / \ D /使用模式匹配技术。

There is a built in function in perl called the index function also use pattern matching like

to use index : index($stringvariable,"char to search"); to determine if a number use the code m/\d/ if you want to determine if a value is a string use m/\D/ Use pattern matching techniques.

Perl字符在带有模式的字符串中搜索(Perl character searching in a string with patterns)

是否有内置函数来确定字符串中是否存在字符。 另外,如何确定值是字符串还是数字。

Is there a built in function on which determines if a character is present in a string. Also how can you determine if a value is a string or a number.

最满意答案

在perl中有一个内置函数,称为索引函数也使用模式匹配

使用index:index($ stringvariable,“char to search”); 确定一个数字是否使用代码m / \ d /如果你想确定一个值是否为字符串使用m / \ D /使用模式匹配技术。

There is a built in function in perl called the index function also use pattern matching like

to use index : index($stringvariable,"char to search"); to determine if a number use the code m/\d/ if you want to determine if a value is a string use m/\D/ Use pattern matching techniques.