Simple split of a text with no space and no character

I am trying with simple split which not working
variableText is type String
SplitVariable is type String

variableText = “01030507”
SplitVariable = variableText.Split()

When i output SplitVariable(0) it gives me 01
But when i output SplitVariable(1) I get error index was outside the bounds of the array :thinking:

can someone help…

Hey @Latif,

See if this post helps you:

@Latif What is the Output that you expect after Splitting ? Do you want each character in the String to be present as an array ?

1 Like

I want this result in that picture…
image
like 01 in first row
02 in second row…

is it possible to do in easy way without putting into for each loop again…
as this variable data is coming from Excel file.

@Latif It is possible to convert into the format you’re looking for but I don’t think you can Insert it into the fields in that way, You may have to use For Each Loop for that. Is that a SAP application ?

yes its SAP i have to insert those value.

@Latif Can you Insert the values manually in that way ?

what you means by manually?

image

I did this and its printing 1 array in field but it can not find the next array position.

1 Like

@Latif You might need to use a For Each Loop for that then to enter each letter from the array to the Specific fields but we need to get the Selector of that field and the field below it. So that in this way we can Alter the Selector to Loop through each field and type the value.

let say I have a string variable… which has value… “01030507”
how can i brack this string into 4 time so I add one time in one and 2nd time in 2nd field and so on.

@Latif Can you tell us what exactly breaking the String into 4 means :sweat_smile:

means split… like
01
02
03
04
:slight_smile:
now i added for each row loop and then i did like this …
image
its printing 01 in each line of SAP row…
why its not talking next arary :s

@Latif So you want each two letter in the String to be together ?

Can you show How the row got filled? Did it type in each row or only one row ?

it write like this
image
through for each loop…

@Latif Do you only have to fill 5 rows ? Can you show the Selector of Type Into Activity using UiExplorer ?

yes… issue is not in selector… I think issue is the value I have in my variable is like
image
thisstring im putting into array variable… and then passing it in for each loop.

But i think i need to split this string before i put in array variable to add into SAP.

@Latif
have a look here on some split acrobatics you may can use:

2 Likes

for splitting with different count of seperating 0 following can be used:


result can be combined with e.g. PadLeft as shown above


Regex is not working :frowning: