#FEATURE by cg jv
authorClaus Gittinger <cg@exept.de>
Mon, 25 Mar 2019 16:43:19 +0100
branchjv
changeset 24089 25972ffd0fb8
parent 24088 24822fc807e7
child 24090 6c96705eeeec
#FEATURE by cg class: String added: #asDenseUnicodeString (grafted from 55b0236c0b3341b10697393a7f491864edbf1ede)
String.st
--- a/String.st	Mon Mar 25 16:28:54 2019 +0100
+++ b/String.st	Mon Mar 25 16:43:19 2019 +0100
@@ -2450,6 +2450,17 @@
     "Modified (comment): / 26-07-2012 / 22:55:26 / cg"
 !
 
+asDenseUnicodeString
+    "return the receiver as single-byte, double byte or 4-byte unicode string,
+     depending on the number of bits required to hold all characters in myself.
+     Use this to extract non-wide parts from a wide string,
+     i.e. after a substring has been copied out of a wide string"
+
+    ^ self
+
+    "Created: / 25-03-2019 / 16:43:07 / Claus Gittinger"
+!
+
 asExternalBytes
     "return a 0-terminated externalBytes collection containing
      my characters.