How can i cut a string into pieces according to a format i wanted for example ;

23:11 GoToUpperClass("324.223.22.1", "asdadas", 1989)


23
11
GoToUpperClass
"324.223.22.1"
"asdadas"
1989

what is the easiest way of doing this?

Get the required string you needed and assign it to a new string. Now use substring to get the required one.

Example

String s="Some text";
String s1=s.SubString(0,1);
string s2=s.SubString(1,2);

Like this you can

The easiest way is to use String.Split(). If you look at your text, you can see that each item is separated from another by a specific character, in this case ':', ' ', '(', ',', ')' so that's what we split on:

char[] splitc = {':', ' ', '(', ',', ')'};
String str = "23:11 GoToUpperClass("324.223.22.1", "asdadas", 1989)";

String[] parts = str.Split(splitc, StringSplitOptions.RemoveEmptyEntries);

After this, parts[0] contains "23", parts[1] contains "11", etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.