2011-12-16T12:51:22-05:00
I need a function that can extract string starting with "$" and ending with " ' " or "," or nothing
Suppose string is
efgh = '$EXPCH.nmo' AND tree = $Name, tree = $pcd
it should return me
EXPCH.nmo
Name
pcd
Any help please...
1
2011-12-20T09:44:59-0500
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace q5712 { class Program { & static void func(char[] str) & { char[,] new_str = new char[10, str.Length]; int n = 0; for (int i = 0; i < str.Length; i++) { if (str[i] == '$') { & i++; & int j = 0; & while(str[i] != ',' && str[i] != (char)39) & { new_str[n, j] = str[i]; j++; i++; if(i == str.Length) break; & } & n++; } } for (int i = 0; i < n; i++) { for (int j = 0; new_str[i, j] != '\0'; j++) & Console.Write(new_str[i, j]); Console.WriteLine(); } & } & static void Main(string[] args) & { string str1; Console.WriteLine("Enter string: "); str1 = Console.In.ReadLine(); func(str1.ToCharArray()); & } } }
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
C#
Comments