Parsing string with 3 hyphens C# -


i have string coo70-123456789-12345-1. need parse based on "-" not length of substrings , use parsed values. have tried using regular expressions having issues.please suggest. after have split values need use each values: string = coo70, int b = 123456789, int c = 12345, short d = 1 . how in different variables a,b,c,d.

string[] results = uniqueid.split('-');  string = results[0]; string b = results[1]; string c = results[2]; int k_id = convert.toint32(k_id); string d = results[3]; short seq = convert.toint16(seq); 

string s = "coo70-123456789-12345-1"; string[] split = s.split('-'); //=> {"coo70", "123456789", "12345", "1"} 

Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -