using namespace System; using namespace System::Collections; String^ StripStartTags( String^ item ) { // try to find a tag at the start of the line using StartsWith if ( item->Trim()->StartsWith( "<" ) ) { // now search for the closing tag->->. int lastLocation = item->IndexOf( ">" ); // remove the identified section, if it is a valid region if ( lastLocation >= 0 ) item = item->Substring( lastLocation + 1 ); } return item; } int main() { // process a string that contains html tags // this sample does not remove embedded tags (tags in the middle of a line) array^strSource = {"This is bold text","

This is large Text

","This has multiple tags","This has embedded tags.","GetEnumerator(); while ( myEnum1->MoveNext() ) { String^ s = safe_cast(myEnum1->Current); Console::WriteLine( s ); } Console::WriteLine(); Console::WriteLine( "The following lists the items after the tags have been stripped:" ); Console::WriteLine( "----------------------------------------------------------------" ); // print [Out] the* array of strings IEnumerator^ myEnum2 = strSource->GetEnumerator(); while ( myEnum2->MoveNext() ) { String^ s = safe_cast(myEnum2->Current); Console::WriteLine( StripStartTags( s ) ); } }