DH_Functions.qsrc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # DH_Functions
  2. !! String Format
  3. if $ARGS[0] = 'FormatStr':
  4. $.FUNC_formatStr = $ARGS[1]
  5. $.FUNC_params_[0] = $ARGS[2]
  6. _FUNC_i = 0
  7. :Loop DH_Functions_FormatStr_Params
  8. if _FUNC_i < ARRSIZE('$ARGS') - 2:
  9. $.FUNC_params_[_FUNC_i] = $ARGS[_FUNC_i + 2]
  10. _FUNC_i += 1
  11. jump 'Loop DH_Functions_FormatStr_Params'
  12. end
  13. _FUNC_i = 0
  14. :Loop DH_Functions_FormatStr_Replace
  15. if _FUNC_i < ARRSIZE('$.FUNC_params_'):
  16. $.FUNC_formatStr = $REPLACE($.FUNC_formatStr, '{<<_FUNC_i>>}', $.FUNC_params_[_FUNC_i])
  17. _FUNC_i += 1
  18. jump 'Loop DH_Functions_FormatStr_Replace'
  19. end
  20. $RESULT = $.FUNC_formatStr
  21. end
  22. !! Concatenate string array
  23. if lcase($ARGS[0]) = 'ConcatStrArr':
  24. KILLVAR '$_FUNC_concat'
  25. KILLVAR '$_FUNC_concatStr'
  26. COPYARR '$_FUNC_concat', '<<$ARGS[1]>>'
  27. _FUNC_i = 0
  28. :Loop DH_Functions_ConcatStrArr_Concatenate
  29. if (_FUNC_i < ARRSIZE('$_FUNC_concat'):
  30. $_FUNC_concatStr += $_FUNC_concat[_FUNC_i]
  31. _FUNC_i += 1
  32. jump 'Loop DH_Functions_ConcatStrArr_Concatenate'
  33. end
  34. $RESULT = $_FUNC_concatStr
  35. end
  36. --- DH_Functions ---------------------------
  37. # StrInsert
  38. !! Original = $ARGS[0]
  39. !! Insert = $ARGS[1]
  40. !! Position = ARGS[2]
  41. $RESULT = mid($ARGS[0], 1, ARGS[2] - 1) + $ARGS[1] + mid($ARGS[0], ARGS[2])
  42. --- StrInsert ------------------------------