C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
And: The string returned by RSet, meanwhile, is padded to 20 characters total by adding spaces to the left.
VB.NET program that uses LSet and RSet functions
Module Module1
Sub Main()
Console.WriteLine("[{0}]", LSet("test", 20))
Console.WriteLine("[{0}]", RSet("test", 20))
Console.WriteLine("[{0}]", LSet("test", 2))
Console.WriteLine("[{0}]", RSet("test", 2))
End Sub
End Module
Output
[test ]
[ test]
[te]
[te]
However: LSet and RSet are more complex than just the pad methods. The implementation has a path that calls Substring.
Tip: It is often a better idea just to use PadRight, PadLeft and Substring directly. This is more standard practice in the .NET Framework.
PadLeft, PadRight