Cleans off leading and trailing spaces and tabs. @param[in] String pointer to the string to trim them off. **/
| 80 | @param[in] String pointer to the string to trim them off. |
| 81 | **/ |
| 82 | EFI_STATUS |
| 83 | TrimSpaces( |
| 84 | IN CHAR16 **String |
| 85 | ) |
| 86 | { |
| 87 | // ASSERT(String != NULL); |
| 88 | // ASSERT(*String!= NULL); |
| 89 | if (!String || !(*String)) { |
| 90 | return EFI_INVALID_PARAMETER; |
| 91 | } |
| 92 | // |
| 93 | // Remove any spaces and tabs at the beginning of the (*String). |
| 94 | // |
| 95 | while (((*String)[0] == L' ') || ((*String)[0] == L'\t')) { |
| 96 | CopyMem((*String), (*String)+1, StrSize((*String)) - sizeof((*String)[0])); |
| 97 | } |
| 98 | |
| 99 | // |
| 100 | // Remove any spaces and tabs at the end of the (*String). |
| 101 | // |
| 102 | while ((StrLen (*String) > 0) && (((*String)[StrLen((*String))-1] == L' ') || ((*String)[StrLen((*String))-1] == L'\t'))) { |
| 103 | (*String)[StrLen((*String))-1] = CHAR_NULL; |
| 104 | } |
| 105 | |
| 106 | return (EFI_SUCCESS); |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | Parse for the next instance of one string within another string. Can optionally make sure that |
no test coverage detected