工行这里学车报名流程h5
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
339 B

  1. function trim(str, pos = 'both') {
  2. if (pos == 'both') {
  3. return str.replace(/^\s+|\s+$/g, "");
  4. } else if (pos == "left") {
  5. return str.replace(/^\s*/, '');
  6. } else if (pos == 'right') {
  7. return str.replace(/(\s*$)/g, "");
  8. } else if (pos == 'all') {
  9. return str.replace(/\s+/g, "");
  10. } else {
  11. return str;
  12. }
  13. }
  14. export default trim