Effacer les filtres
Effacer les filtres

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

26 vues (au cours des 30 derniers jours)
Aga
Aga le 21 Mar 2014
Commenté : Aga le 24 Mar 2014
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

Réponse acceptée

per isakson
per isakson le 21 Mar 2014
Modifié(e) : per isakson le 21 Mar 2014
"^" 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 commentaires
per isakson
per isakson le 21 Mar 2014
"~" 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 le 24 Mar 2014
thanks!, I changed to 'not' .

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by