MPAS-Dev / MPAS-Model

Repository for MPAS models and shared framework releases.
238 stars 317 forks source link

Trim strings before splitting #1108

Closed dimomatt closed 1 year ago

dimomatt commented 1 year ago

This commit adds a step to the mpas_split_string subroutine. In the process of adding tests, it was discovered that splitting a string while using a space as a delimiter causes the string to be split on every trailing space, leading to a splitStrings array that is equal to the size of the untrimmed input string, minus the number of non-space characters, plus one. This behavior is unwanted.

This has been solved this by trimming off trailing spaces before splitting the string. This has been tested with the new tests in PR #1107 and confirmed to pass these tests as expected. This PR should be merged prior to #1107, as the first test splits based on a space character delimiter, and will fail without these changes to the mpas_split_string routine.