Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PadRight
Message
De
05/12/2008 11:59:17
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01365649
Message ID:
01365706
Vues:
12
Thats what I needed.

Thanks,

Jerry


>>I need to get the first 10 characters from a string. If the string is less than 10, I want to pad it to the right with spaces. If the string is over 10, I want to chop off everything pass position 10.
>>
>>How can I do this?
>>
>>
>>Example:
>>"Joe.Smith"     // I need 1 space added to the end. 'Joe.Smith '
>>"Steve.Smith"  // I need 'Steve.Smit'
>>
>>
>
>Try something like this:
>
>
>string name = "Joe.Smith";
>//name = "Steve.Smith";
>name = name.PadRight(10, ' ').Substring(0, 10);
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform