How to split string into custom lengths of caracters

Dear friends!
My string contains defined (fixed) lenghts of caracters. How can I define the variables to be a fixed amounts of caracters*? Like this:
variableStatus (3 caracters)
variableSpaces1 (4 caracters)
variableName (25 caracters)
variableSpaces2 (5 caracters)
variableAddress (30 spaces)
variableSpaces3 (7 spaces) and so on…

*= Sometimes the strings miss content, then it is filled with spaces. This means that sometimes the variable will be empty. Se example in red circle containing Town in the third line. This may occur anywhere in string, you can never know :slight_smile: But the amount of caracters remains the same (it’s filled with spaces).

Please refer my illustration.

Have a look on the substring method. With length and Index Parameter the different information should be extractable.


Hey @bjorn2390,

Your could try using a substring for the length:

Get the variable, then use an assign: VariableStatus=VariableStatus.ToString.Substring(0,3)

The 0 is the starting position of the characters in the string and the 3 is the length of characters to get from the initial starting point, in this case, 0.



Thanks for the pointer. This is not for newbies, but I am reading hard on the subject!

Thanks. I am sure this will become my solution in this matter. I’m on it, trying to figure it out :grinning: