I\'m interfacing with a really old system and the file I need to generate needs a field that is a formed from a string but needs to be exactly 15 in width.
I want so
Use String.format with a format string. Surely something there will do what you want :-)
This code would do what you want:
scala> val companyName = "FooBar, Inc" companyName: String = FooBar, Inc scala> f"$companyName%15s" res0: String = " FooBar, Inc"