While using the split function getting error(One dimensional array cannot be converted to string)

studio

#1

I am trying to get the order Id from the below page,

image

While using assign activity to split the text am getting the error, 1 dimensional array cannot be converted to string

image

can anyone please help me to fix this issue?

Thanks!
Jose


#2

Hi @shajanjose,

strvalue="Order number 60003946 saved"
strOrderNumber=strvalue.Split(" ".ToCharArray())(2)

if you are splitting the string variable you need to put some condition to identity from based on what character need to split.

if you use split function it will return the array value.
For example

string s = "there is a cat";
        // Split string on spaces.
        // ... This will separate all the words.
        string[] words = s.Split(' ');
        foreach (string word in words)
        {
            Console.WriteLine(word);
        }

Refer this link
http://csharp.net-informations.com/string/csharp-string-split.htm

https://www.dotnetperls.com/split
Regards, Arivu :slight_smile:


#3

Try

str.Split(" ".ToCharArray())(2)

Maybe it works.


#4

Thanks Honoka, this solution is working :slight_smile: