aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-02-13 10:12:16 +0100
committerGravatar Christian Hesse <mail@eworm.de>2023-02-13 10:35:27 +0100
commit7d3c4738d07e040cbe3c293ef0b2be04631290eb (patch)
tree161b59f97d34edebe90029b5b6b017916f4b493b
parent62707dc549855e1c4247a9d2df599afc48782902 (diff)
global-functions: introduce $Unix2Dos
-rw-r--r--global-functions11
1 files changed, 11 insertions, 0 deletions
diff --git a/global-functions b/global-functions
index 89d2612..84c7ece 100644
--- a/global-functions
+++ b/global-functions
@@ -55,6 +55,7 @@
:global SendNotification2;
:global SymbolByUnicodeName;
:global SymbolForNotification;
+:global Unix2Dos;
:global UrlEncode;
:global ValidateSyntax;
:global VersionToNum;
@@ -1125,6 +1126,16 @@
:return ($Return . " ");
}
+# convert line endings, UNIX -> DOS
+:set Unix2Dos do={
+ :local Input [ :tostr $1 ];
+
+ :global CharacterReplace;
+
+ :return [ $CharacterReplace [ $CharacterReplace $Input \
+ ("\n") ("\r\n") ] ("\r\r\n") ("\r\n") ];
+}
+
# url encoding
:set UrlEncode do={
:local Input [ :tostr $1 ];