Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PadRight
Message
From
05/12/2008 11:59:17
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
 
General information
Forum:
ASP.NET
Category:
Other
Title:
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01365649
Message ID:
01365706
Views:
11
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);
>
Previous
Reply
Map
View

Click here to load this message in the networking platform