soartech / jsoar

Pure Java implementation of the Soar cognitive architecture.
http://soartech.github.com/jsoar/
BSD 3-Clause "New" or "Revised" License
53 stars 19 forks source link

Add new RHS trim function #138

Closed rezamini closed 1 year ago

rezamini commented 1 year ago

This Pull Request introduces a new RHS "trim" function that takes a single string symbol argument and returns the same string with leading and trailing whitespace removed.

Similar to PR #137 , this function is based on the specifications outlined in the Soar Manual documentation (3.3.6.6 Right-hand side Functions, page 80). The proposed changes have undergone testing, and a test file has been included to ensure the accurate implementation of the new RHS trim function.

marinier commented 1 year ago

Thank you for this! Can you replace the call to trim() with strip()? The difference is that strip() properly handles unicode. I don't know how well the rest of jsoar handles unicode, but at least we can make sure this part does.

rezamini commented 1 year ago

Certainly! I have made the changes and committed the updated code. In addition, I have added new test cases to verify that the updated code properly handles unicodes and whitespaces. Thank you for bringing this to my attention.

marinier commented 1 year ago

Looks great! Thank you again! Merged.