Any Kind Soul willing to help? I am currently having a string of data and i wanted to convert them into a table form. The string is in this way N00000S1P30 and i wanted to split it into
Parts number
00000
Value
1st spin 30.0
Can anyone kindly guide me through? Thank you so much!!!!
Loading
Leung JiaJun RandsonPosted Jun 6, 2012, 8:13 PM
Good morning bruda, I have a total of 6 keywords ( N, Q, T, L, A, S)
N= Part number
Q= Data identifier ( 1: Parameter data, 0: Pitch error compensation data)
T= Machine Group ( example: T1=10000001) = (1st machine group:bit 0 and 7 set to 1, and other bit is set to 0)
(T2=00000001) = (2nd machine group: bit 0 set to 1, and other bit are set to 0)
L= Path Number (example: L1= path1 L2= path 2 etc etc)
A= Axis (example: A1= 1st Axis, A2=2ndAxis)
S= spin ( example: S1= 1st spin, S2= 2nd Spin)
Example: N00000Q1L1P88T1A1S1P110000001
= Part: 00000
Path1:88
1st machine group: bit 0 and bit 7 set to 1, others set to 0
1st axis:bit 0 and bit 7 set to 1, others set to 0
1st spin:bit 0 and bit 7 set to 1, others set to 0
Bruda Pls help. Thank you so much. Appreciated..
Thank you very very much
brunda kPosted Jun 6, 2012, 5:43 AM
details about the table was not provided.
Assumptions: all the strings will be in format N PartNumber S Spin Number P Decimal Digit
Leung JiaJun RandsonPosted Jun 6, 2012, 3:53 AM
Thank you so much. But it appear telling me
"N([0-9]+S([0-9]+)P([0-9]+([\.][0-9]{1,3})?$)" -Not Enough)'s
What is the meaning ????
brunda kPosted Jun 6, 2012, 2:02 AM
Match match = Regex.Match(input, @"N([0-9]+)S([0-9]+)P([0-9]+([\.][0-9]{1,3})?$)", RegexOptions.IgnoreCase);
if (match.Success)
{
StringBuilder sb = new StringBuilder();
sb.Append("Parts Number \n");
sb.Append(match.Groups[1].Value.ToString()+"\n");
sb.Append("Value \n");
sb.Append(match.Groups[2].Value.ToString() + "st spin "+ ((match.Groups[3].Value.ToString().Contains(".")) ? (match.Groups[3].Value.ToString()) : match.Groups[3].Value.ToString() + ".0"));
Console.WriteLine(sb.ToString());
}
Thankyou!