Hoa go separate the text contains more than 1000 semi columns (;)

Hi Team,
I have string variable like 12; 13;14;15;16;17;18;19;10 etc…

If string contains more than semicolon (;). Need to separate the string in to multiple strings.

For example i have string contains 1074 semicolon (;).
Ap i need to split the data in to 2 parts string1 have 1000 and string2 have 74
Because my application is support to entere only 1000 strings at a time
That’s the reason i need to split the strings if more than 1000 semi columns.

Kindly suggest the solution asap.

Thanks.

Hi @Ramudu

Try this

arrValues = InputString.Split(";"c)  
If arrValues.Length > 1000 Then
    string1 = String.Join(";", arrValues.Take(1000))  
    string2 = String.Join(";", arrValues.Skip(1000))   
Else
    string1 = InputString
    string2 = String.Empty 
End If

Regards,

Hi @Ramudu ,
To split the string into two parts — with the first part containing 1,000 semicolon-separated numbers and the second part containing the remaining 74
Use the Split method to separate the string by semicolons (;).
image
input.Split(“;“c)
Extract First 1,000 Items:Use String.Join to join the first 1,000 elements
image
String.Join(”;”, arr_numbers.Take(1000))
Extract Remaining Items (74):Use String.Join to join the remaining elements
image
String.Join(“;”, arr_numbers.Skip(1000))

Thanks and Regards ,
Sneha

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.