You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Padding Strings should specify what it does with strings shorter than the Int32 #4392
Neither one answered my question: What would it do if the string was longer than the Int32 passed to pad it to? Would it truncate my string? Would it simply return the string as it was? Would it throw an error? The answer, mind you, from actually testing it in Visual Studio, is option B: It just leaves the string alone, which is a good reasonable way for .NET to behave.
...But I was annoyed this wasn't in the documentation.
First time visitor, figured I'd ask if it's okay to add that.
Thanks for opening this issue and identifying an information gap in the documentation, @ocdtrekkie. Feel free to open an issue when you notice missing, incomplete, or inaccurate information. If you're interested in addressing the issue yourself, you can also open a pull request.
We'll add information on padding a string whose length already exceeds the padded length in the near future.
The MSDN link is to the overload list page, which is intended to contain minimal information. Since the overload list page does not exist on docs.microsoft.com, the documentation for both overloads of String.PadLeft and String.PadRight document what happens if the desired length is less than the actual string length. As a result, only the Padding Strings in .NET topic needs modification.
Ah! I do see the answer if I click on one of the overloads in the MSDN link, and on the respective String.PadLeft/Right pages on Docs. I guess I didn't dig deep enough! Your modification to the Padding Strings in .NET page should definitely help though, thank you.
Activity
rpetrusha commentedon Feb 15, 2018
Thanks for opening this issue and identifying an information gap in the documentation, @ocdtrekkie. Feel free to open an issue when you notice missing, incomplete, or inaccurate information. If you're interested in addressing the issue yourself, you can also open a pull request.
We'll add information on padding a string whose length already exceeds the padded length in the near future.
rpetrusha commentedon Mar 14, 2018
The MSDN link is to the overload list page, which is intended to contain minimal information. Since the overload list page does not exist on docs.microsoft.com, the documentation for both overloads of String.PadLeft and String.PadRight document what happens if the desired length is less than the actual string length. As a result, only the Padding Strings in .NET topic needs modification.
ocdtrekkie commentedon Mar 14, 2018
Ah! I do see the answer if I click on one of the overloads in the MSDN link, and on the respective String.PadLeft/Right pages on Docs. I guess I didn't dig deep enough! Your modification to the Padding Strings in .NET page should definitely help though, thank you.