Created
September 30, 2014 01:28
-
-
Save Fhernd/5d6730fdaf74fd970042 to your computer and use it in GitHub Desktop.
Clase estática con métodos de extensión.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Articulos.CSharp.MetodosExtension | |
{ | |
public static class AyudanteString | |
{ | |
// Determina si la primera letra de una cadena de | |
// caracteres es una letra mayúscula (capitalizada): | |
public static bool EstaCapitalizada(this String cadena) | |
{ | |
if (String.IsNullOrEmpty (cadena)) | |
{ | |
return false; | |
} | |
return Char.IsUpper (cadena[0]); | |
} | |
// Pluraliza una palabra: | |
public static string Pluralizar(this String cadena) | |
{ | |
if (String.IsNullOrEmpty (cadena)) | |
{ | |
return ""; | |
} | |
return String.Format("{0}s", cadena); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment