Link to home
Start Free TrialLog in
Avatar of zimmer9
zimmer9Flag for United States of America

asked on

How to read the rightmost 8 positions into a string using a C# console application?

I am developing a C# Console application using Visual Studio 2005.

My code follows in the code section.

How could I change the code and replace the following statement:
String formattedString = itemsequence.Substring(7, 8);

with another statement that assigns the rightmost 8 positions to formattedString, since I am checking for a field length of at least 8 positions and I want to assign just the right most positions.
if (reader.Name.Length >= 8)
                            {
                                arr1[i, 11] = "GROUP_FIELD_NAME:CpcsNo";
                                itemsequence = reader.ReadElementContentAsString();
                                String formattedString = itemsequence.Substring(7, 8);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of gena17
gena17

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial