I'm looking for several everyday string handling functions. Most I've been able to find in the PureBasic documentation, but not the following. Hope someone can advise if there are equivalents.
1. PureBasic has
var.s=space(n) to generate n spaces, but I can’t find something similar to generate n specified repeating characters or repeating strings.
The language I’ve used in the past, which is PICK DataBasic, has the following, which will generate
AbAbAbAbAb
2. Extracting an item of delimited text based on a delimiter/separator in a string
If I want the third value, how do I specify that?
Again, in the language I’m more familiar with, this would be done like so…
3.a. Padding a value so that it appears justified in a column. For instance, each of the set of numbers,
4 45 128 needs to be padded with leading spaces to make each of them six characters in width.
The language I’ve been using provides what’s called a ‘format string’ for which incidentally the
R means right-justify and
6 is the justification width.
Code: Select all
value.s = “45”
result.s = value’R#6’
3.b. It also provides the following for inserting commas between thousands…
Code: Select all
value.s = “978000”
result.s = value’R,#6’
3.c. And we could left-justify with the below, which will place the padding on the end of the output.
These string handling features tend to be appropriate and have very practical uses for developing business apps. A lot of other languages I've used, such as C# provide comparatively very little by way of string handling when it comes to this kind of simple requirement. Like a lot of modern languages, they over-complicate what should be an everyday need, a case in point being Regex. Hoping that PB provides something non-complicated anyway. Thanks.