what does [^\n\r]' mean?

22 次查看(过去 30 天)
Aga
Aga 2014-3-21
评论: Aga 2014-3-24
hi there, i have a sutpi question.. at the and of the string cpnversion specifiers of the matlab implemented import file function there is [^\n\r]. New line and carriage return is clear to me, but what the '^'means?..
formatSpec = '%s%s%s%s%f%f%f%s%s%s%[^\n\r]';
thanks in advance
aga

采纳的回答

per isakson
per isakson 2014-3-21
编辑:per isakson 2014-3-21
"^" is a negation. %[^\r\n] matches everything but line break, i.e. the rest of the line. Doc says
Exclude characters inside the brackets, reading until the first matching
character.
  3 个评论
per isakson
per isakson 2014-3-21
"~" is shorthand for the logical function not. (IMO: Use not, it makes the code more readable.) [^\r\n] is a loan from regular expression.
Aga
Aga 2014-3-24
thanks!, I changed to 'not' .

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by