Skip to content

Commit

Permalink
opt: whitespace and punct character
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Jul 17, 2024
1 parent 9651e1b commit a6781e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/folding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,14 @@ wstring trimWhitespaceOrPunct( wstring const & in )
wstring::size_type wordSize = in.size();

// Skip any leading whitespace
while ( *wordBegin && ( Folding::isWhitespace( *wordBegin ) || Folding::isPunct( *wordBegin ) ) ) {
while ( *wordBegin && Folding::isWhitespaceOrPunct( *wordBegin ) ) {
++wordBegin;
--wordSize;
}

// Skip any trailing whitespace
while ( wordSize
&& ( Folding::isWhitespace( wordBegin[ wordSize - 1 ] ) || Folding::isPunct( wordBegin[ wordSize - 1 ] ) ) )
&& Folding::isWhitespaceOrPunct( wordBegin[ wordSize - 1 ] ) )
--wordSize;

return wstring( wordBegin, wordSize );
Expand Down

0 comments on commit a6781e4

Please sign in to comment.