Str. Erase (remove_if (Str. Begin (), str. End (), ptr_fun (isspace), str. End ());
Who can send better messages?
Evaluate the Left and Right Spaces Code .
Tchar tempname [256] = {0 };
Tchar temptype [256] = {0 };
Fscanf (FP, "% s", temp); // obtain the field name
// Continue;
For (INT I = 0; I <strlen (temp); I ++ ){
Tempname [I] = temp [I];
}
Fgets (temp, 256, FP); // obtain the field type.
For (INT I = 0; I <strlen (temp); I ++ ){
Temptype [I] = temp [I];
}
Trim (temptype );
Trim (tempname );
// Remove the left space function
Tchar * creadmifdoc: ltrim (tchar * temp) {// * temp = temp [0]
Int Len = strlen (temp );
Tchar tempstr [256] = {0 };
For (INT I = 0; I <len-1; I ++)
{
If (temp [I]! = ''){
For (Int J = 0; I <len-1; j ++, I ++ ){
Tempstr [J] = temp [I];
}
Break;
}
}
Return tempstr;
}
// Remove right space function
Tchar * creadmifdoc: rtrim (tchar * temp ){
Int Len = strlen (temp );
For (INT I = Len; I> = 0; I --){
If (temp [I-2]! = '') {// Temp [I-2] is the penultimate element, temp [I-1] = '\ 0'
Temp [I] = '\ 0 ';
Break; // The Terminator truncates the character array.
}
}
Return temp;
}
Tchar * creadmifdoc: trim (tchar * temp ){
Return ltrim (rtrim (temp ));
}