#FEATURE
authorClaus Gittinger <cg@exept.de>
Thu, 11 Feb 2016 14:45:42 +0100
changeset 19168 f09f654da659
parent 19166 22f1ee605c16
child 19169 a1efd2d6d7ca
#FEATURE class: ExternalBytes added: #replaceNullTerminatedFromString:
ExternalBytes.st
--- a/ExternalBytes.st	Wed Feb 10 19:15:09 2016 +0100
+++ b/ExternalBytes.st	Thu Feb 11 14:45:42 2016 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -1061,6 +1059,13 @@
 	    with:#[10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160]
 	    startingAt:0
     "
+!
+
+replaceNullTerminatedFromString:aString
+    "replace elements from aString, and add a 0-byte at the end"
+
+    self replaceBytesFrom:1 to:aString size with:aString startingAt:1.
+    self at:aString size+1 put:0.
 ! !
 
 !ExternalBytes methodsFor:'finalization'!