Outils pour utilisateurs

Outils du site


lang:csharp:textes

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
lang:csharp:textes [2017/05/16 12:07] – Ajout de "Expression régulière" rootlang:csharp:textes [2020/04/28 21:18] (Version actuelle) – mhtml -> html root
Ligne 32: Ligne 32:
 </code> </code>
  
-[[http://stackoverflow.com/questions/333737/evaluating-string-342-yield-int-18|Source]]{{ :lang:csharp:textes:c_-_evaluating_string_3_4_2_yield_int_18_-_stack_overflow.maff |Archive}}+[[http://stackoverflow.com/questions/333737/evaluating-string-342-yield-int-18|c# - Evaluating string _3_(4+2)_ yield int 18 - Stack Overflow]] {{ :lang:csharp:textes:c_-_evaluating_string_3_4_2_yield_int_18_-_stack_overflow_2020-04-28_9_13_20_pm_.html |Archive du 02/12/2008 le 28/04/2020}}
  
 =====Concaténation de string===== =====Concaténation de string=====
Ligne 48: Ligne 48:
 </code> </code>
  
-[[http://stackoverflow.com/questions/3414900/how-to-get-a-char-from-an-ascii-character-code-in-c-sharp|Source]]{{ :lang:csharp:textes:how_to_get_a_char_from_an_ascii_character_code_in_c_-_stack_overflow.maff |Archive}}+[[http://stackoverflow.com/questions/3414900/how-to-get-a-char-from-an-ascii-character-code-in-c-sharp|How to get a Char from an ASCII Character Code in c# - Stack Overflow]] {{ :lang:csharp:textes:how_to_get_a_char_from_an_ascii_character_code_in_c_-_stack_overflow_2020-04-28_9_13_17_pm_.html |Archive du 05/08/2010 le 28/04/2020}} 
 + 
 +Cependant, cela ne marche pas forcément très bien en fonction des besoins : le symbole ''œ'' renverra 339 et non pas 156. 
 + 
 +Pour récupérer 156, il faut : 
 +<code csharp> 
 +Encoding.Default.GetBytes("œ")[0]; 
 +</code>
  
 =====Expression régulière===== =====Expression régulière=====
Ligne 62: Ligne 69:
 </code> </code>
  
-[[https://www.dotnetperls.com/regex|Source]]{{ :lang:csharp:textes:c_regex.match_examples_regular_expressions_-_dot_net_perls.maff |Archive}}+[[https://www.dotnetperls.com/regex|C# Regex.Match Examples_ Regular Expressions - Dot Net Perls]] {{ :lang:csharp:textes:c_regex.match_examples_regular_expressions_-_dot_net_perls_2020-04-28_9_13_15_pm_.html |Archive le 28/04/2020}} 
 + 
 +=====Le caractère null===== 
 +Pour déterminer la longueur d'une chaîne de caractère, on utilise la propriété ''Length'', là où en ''C'', on recherche le caractère ''null''
 + 
 +Mais il peut arriver qu'une chaîne de caractère (en ''C#'') possède un caractère ''null''. Pour vérifier sa présence, il faut faire tout simplement : 
 +<code csharp> 
 +texte.IndexOf('\0') != -1 
 +</code> 
 + 
 +=====Comparaison insensible à la casse===== 
 +<code csharp> 
 +StartsWith("texte", StringComparison.OrdinalIgnoreCase); 
 +EndsWith("texte", StringComparison.OrdinalIgnoreCase); 
 +IndexOf("texte", StringComparison.OrdinalIgnoreCase); 
 +Equals("texte1", "texte2", StringComparison.OrdinalIgnoreCase); 
 +</code>
lang/csharp/textes.1494929274.txt.gz · Dernière modification : 2017/05/16 12:07 de root